[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] usbif.py, netif.py, controller.py, console.py, blkif.py, XendDomainInfo.py:



ChangeSet 1.1662.1.4, 2005/06/06 14:04:01+01:00, cl349@xxxxxxxxxxxxxxxxxxxx

        usbif.py, netif.py, controller.py, console.py, blkif.py, 
XendDomainInfo.py:
          Cleanup imports.
        XendDomain.py:
          Cleanup imports and some function comments.
          BUG: Add back missing _add_domain call in domain_create.
        SrvDaemon.py:
          g/c DEBUG and DAEMONIZE.
        XendCheckpoint.py:
          Cleanup domain id/name confusion.
        Signed-off-by: Mike Wray <mike.wray@xxxxxx>
        Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>



 XendCheckpoint.py    |    4 ++--
 XendDomain.py        |   41 ++++++++++++++++++-----------------------
 XendDomainInfo.py    |   22 ++++++++++------------
 server/SrvDaemon.py  |    3 ---
 server/blkif.py      |   14 +++++++-------
 server/console.py    |    6 +++---
 server/controller.py |    2 +-
 server/netif.py      |    6 +++---
 server/usbif.py      |    6 +++---
 9 files changed, 47 insertions(+), 57 deletions(-)


diff -Nru a/tools/python/xen/xend/XendCheckpoint.py 
b/tools/python/xen/xend/XendCheckpoint.py
--- a/tools/python/xen/xend/XendCheckpoint.py   2005-06-09 13:04:37 -04:00
+++ b/tools/python/xen/xend/XendCheckpoint.py   2005-06-09 13:04:37 -04:00
@@ -63,10 +63,10 @@
             if fd == child.fromchild.fileno():
                 l = child.fromchild.readline()
                 if l.rstrip() == "suspend":
-                    log.info("suspending %s" % dominfo.id)
+                    log.info("suspending %d" % dominfo.id)
                     xd.domain_shutdown(dominfo.id, reason='suspend')
                     dominfo.state_wait("suspended")
-                    log.info("suspend %s done" % dominfo.id)
+                    log.info("suspend %d done" % dominfo.id)
                     child.tochild.write("done\n")
                     child.tochild.flush()
         if filter(lambda (fd, event): event & select.POLLHUP, r):
diff -Nru a/tools/python/xen/xend/XendDomain.py 
b/tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       2005-06-09 13:04:37 -04:00
+++ b/tools/python/xen/xend/XendDomain.py       2005-06-09 13:04:37 -04:00
@@ -7,25 +7,23 @@
 """
 import errno
 import os
-import scheduler
-import string
 import sys
-import traceback
 import time
+import traceback
 
 import xen.lowlevel.xc; xc = xen.lowlevel.xc.new()
 
-from xen.xend.server import relocate
-import sxp
-import XendRoot; xroot = XendRoot.instance()
-import XendCheckpoint
-import XendDB
+from xen.xend import sxp
+from xen.xend import XendRoot; xroot = XendRoot.instance()
+from xen.xend import XendCheckpoint
 from xen.xend.XendDomainInfo import XendDomainInfo, shutdown_reason
-import EventServer; eserver = EventServer.instance()
-from XendError import XendError
-from XendLogging import log
-
+from xen.xend import EventServer; eserver = EventServer.instance()
+from xen.xend.XendError import XendError
+from xen.xend.XendLogging import log
+from xen.xend import scheduler
 from xen.xend.server import channel
+from xen.xend.server import relocate
+from xen.xend import XendDB
 
 __all__ = [ "XendDomain" ]
 
@@ -55,7 +53,6 @@
         # So we stuff the XendDomain instance (self) into xroot's components.
         xroot.add_component("xen.xend.XendDomain", self)
         self.domains = XendDomainDict()
-        # Table of domain info indexed by domain id.
         self.db = XendDB.XendDB(self.dbpath)
         eserver.subscribe('xend.virq', self.onVirq)
         self.initial_refresh()
@@ -160,9 +157,9 @@
         info = self.domains.get(id)
         if info:
             del self.domains[id]
+            self.db.delete(str(id))
             if notify:
                 eserver.inject('xend.domain.died', [info.name, info.id])
-            self.db.delete(str(id))
 
     def reap(self):
         """Look for domains that have crashed or stopped.
@@ -179,11 +176,9 @@
                 casualties.append(d)
         for d in casualties:
             id = d['dom']
-            #print 'reap>', id
             dominfo = self.domains.get(id)
             name = (dominfo and dominfo.name) or '??'
             if dominfo and dominfo.is_terminated():
-                #print 'reap> already terminated:', id
                 continue
             log.debug('XendDomain>reap> domain died name=%s id=%d', name, id)
             if d['shutdown']:
@@ -268,6 +263,7 @@
         @return: domain
         """
         dominfo = XendDomainInfo.create(config)
+        self._add_domain(dominfo)
         return dominfo
 
     def domain_restart(self, dominfo):
@@ -296,14 +292,13 @@
         """Configure an existing domain. This is intended for internal
         use by domain restore and migrate.
 
-        @param id:       domain id
         @param vmconfig: vm configuration
         """
         config = sxp.child_value(vmconfig, 'config')
         dominfo = XendDomainInfo.restore(config)
         self._add_domain(dominfo)
         return dominfo
-    
+
     def domain_restore(self, src, progress=False):
         """Restore a domain from file.
 
@@ -604,7 +599,7 @@
 
         @param id:   domain id
         @param devconfig: device configuration
-        @param devid:  device index
+        @param devid:  device id
         @return: updated device configuration
         """
         dominfo = self.domain_lookup(id)
@@ -616,7 +611,7 @@
         """Refresh a device.
 
         @param id:  domain id
-        @param devid:  device index
+        @param devid:  device id
         @param type: device type
         """
         dominfo = self.domain_lookup(id)
@@ -628,7 +623,7 @@
         """Destroy a device.
 
         @param id:  domain id
-        @param devid:  device index
+        @param devid:  device id
         @param type: device type
         """
         dominfo = self.domain_lookup(id)
@@ -648,10 +643,10 @@
 
     def domain_devtype_get(self, id, type, devid):
         """Get a device from a domain.
-
+        
         @param id:  domain
         @param type: device type
-        @param devid:  device index
+        @param devid:  device id
         @return: device object (or None)
         """
         dominfo = self.domain_lookup(id)
diff -Nru a/tools/python/xen/xend/XendDomainInfo.py 
b/tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   2005-06-09 13:04:37 -04:00
+++ b/tools/python/xen/xend/XendDomainInfo.py   2005-06-09 13:04:37 -04:00
@@ -14,21 +14,20 @@
 import threading
 
 import xen.lowlevel.xc; xc = xen.lowlevel.xc.new()
-import xen.util.ip
-from xen.xend.server import channel, controller
+from xen.util.ip import check_subnet, get_current_ipgw
 from xen.util.blkif import blkdev_uname_to_file
 
-from server.channel import channelFactory
-import server.SrvDaemon; xend = server.SrvDaemon.instance()
-from server import messages
+from xen.xend.server import channel, controller
+from xen.xend.server import SrvDaemon; xend = SrvDaemon.instance()
+from xen.xend.server import messages
+from xen.xend.server.channel import channelFactory
 
+from xen.xend import sxp
+from xen.xend.PrettyPrint import prettyprintstring
 from xen.xend.XendBootloader import bootloader
-import sxp
-from XendLogging import log
+from xen.xend.XendLogging import log
 from XendError import XendError, VmError
-from XendRoot import get_component
-
-from PrettyPrint import prettyprintstring
+from xen.xend.XendRoot import get_component
 
 """Flag for a block device backend domain."""
 SIF_BLK_BE_DOMAIN = (1<<4)
@@ -145,7 +144,6 @@
 def get_device_handler(name):
     return device_handlers[name]
 
-
 def dom_get(dom):
     """Get info from xen for an existing domain.
 
@@ -321,7 +319,7 @@
 
     def __str__(self):
         s = "domain"
-        s += " id=" + self.id
+        s += " id=" + str(self.id)
         s += " name=" + self.name
         s += " memory=" + str(self.memory)
         console = self.getConsole()
diff -Nru a/tools/python/xen/xend/server/SrvDaemon.py 
b/tools/python/xen/xend/server/SrvDaemon.py
--- a/tools/python/xen/xend/server/SrvDaemon.py 2005-06-09 13:04:37 -04:00
+++ b/tools/python/xen/xend/server/SrvDaemon.py 2005-06-09 13:04:37 -04:00
@@ -32,9 +32,6 @@
 import relocate
 from params import *
 
-DAEMONIZE = 0
-DEBUG = 1
-
 class Daemon:
     """The xend daemon.
     """
diff -Nru a/tools/python/xen/xend/server/blkif.py 
b/tools/python/xen/xend/server/blkif.py
--- a/tools/python/xen/xend/server/blkif.py     2005-06-09 13:04:37 -04:00
+++ b/tools/python/xen/xend/server/blkif.py     2005-06-09 13:04:37 -04:00
@@ -3,16 +3,16 @@
 """
 import string
 
-from xen.xend import sxp
-from xen.xend import Blkctl
-from xen.xend.XendError import XendError, VmError
-from xen.xend.XendLogging import log
 from xen.util import blkif
+from xen.xend.XendError import XendError, VmError
 from xen.xend.XendRoot import get_component
+from xen.xend.XendLogging import log
+from xen.xend import sxp
+from xen.xend import Blkctl
 
-import channel
-from controller import CtrlMsgRcvr, Dev, DevController
-from messages import *
+from xen.xend.server import channel
+from xen.xend.server.controller import CtrlMsgRcvr, Dev, DevController
+from xen.xend.server.messages import *
 
 class BlkifBackend:
     """ Handler for the 'back-end' channel to a block device driver domain
diff -Nru a/tools/python/xen/xend/server/console.py 
b/tools/python/xen/xend/server/console.py
--- a/tools/python/xen/xend/server/console.py   2005-06-09 13:04:37 -04:00
+++ b/tools/python/xen/xend/server/console.py   2005-06-09 13:04:37 -04:00
@@ -14,9 +14,9 @@
 from xen.xend import XendRoot; xroot = XendRoot.instance()
 from xen.xend import sxp
 
-from controller import CtrlMsgRcvr, Dev, DevController
-from messages import *

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.