ia64/xen-unstable

changeset 5336:7d8015b52943

bitkeeper revision 1.1662.1.4 (42a449c17mlN0vfY0fcb2leEnvVb-A)

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@hp.com>
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Mon Jun 06 13:04:01 2005 +0000 (2005-06-06)
parents 46ed74bb2921
children c3febeed5ba7
files tools/python/xen/xend/XendCheckpoint.py tools/python/xen/xend/XendDomain.py tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/server/SrvDaemon.py tools/python/xen/xend/server/blkif.py tools/python/xen/xend/server/console.py tools/python/xen/xend/server/controller.py tools/python/xen/xend/server/netif.py tools/python/xen/xend/server/usbif.py
line diff
     1.1 --- a/tools/python/xen/xend/XendCheckpoint.py	Mon Jun 06 09:59:18 2005 +0000
     1.2 +++ b/tools/python/xen/xend/XendCheckpoint.py	Mon Jun 06 13:04:01 2005 +0000
     1.3 @@ -63,10 +63,10 @@ def save(xd, fd, dominfo):
     1.4              if fd == child.fromchild.fileno():
     1.5                  l = child.fromchild.readline()
     1.6                  if l.rstrip() == "suspend":
     1.7 -                    log.info("suspending %s" % dominfo.id)
     1.8 +                    log.info("suspending %d" % dominfo.id)
     1.9                      xd.domain_shutdown(dominfo.id, reason='suspend')
    1.10                      dominfo.state_wait("suspended")
    1.11 -                    log.info("suspend %s done" % dominfo.id)
    1.12 +                    log.info("suspend %d done" % dominfo.id)
    1.13                      child.tochild.write("done\n")
    1.14                      child.tochild.flush()
    1.15          if filter(lambda (fd, event): event & select.POLLHUP, r):
     2.1 --- a/tools/python/xen/xend/XendDomain.py	Mon Jun 06 09:59:18 2005 +0000
     2.2 +++ b/tools/python/xen/xend/XendDomain.py	Mon Jun 06 13:04:01 2005 +0000
     2.3 @@ -7,25 +7,23 @@
     2.4  """
     2.5  import errno
     2.6  import os
     2.7 -import scheduler
     2.8 -import string
     2.9  import sys
    2.10 +import time
    2.11  import traceback
    2.12 -import time
    2.13  
    2.14  import xen.lowlevel.xc; xc = xen.lowlevel.xc.new()
    2.15  
    2.16 -from xen.xend.server import relocate
    2.17 -import sxp
    2.18 -import XendRoot; xroot = XendRoot.instance()
    2.19 -import XendCheckpoint
    2.20 -import XendDB
    2.21 +from xen.xend import sxp
    2.22 +from xen.xend import XendRoot; xroot = XendRoot.instance()
    2.23 +from xen.xend import XendCheckpoint
    2.24  from xen.xend.XendDomainInfo import XendDomainInfo, shutdown_reason
    2.25 -import EventServer; eserver = EventServer.instance()
    2.26 -from XendError import XendError
    2.27 -from XendLogging import log
    2.28 -
    2.29 +from xen.xend import EventServer; eserver = EventServer.instance()
    2.30 +from xen.xend.XendError import XendError
    2.31 +from xen.xend.XendLogging import log
    2.32 +from xen.xend import scheduler
    2.33  from xen.xend.server import channel
    2.34 +from xen.xend.server import relocate
    2.35 +from xen.xend import XendDB
    2.36  
    2.37  __all__ = [ "XendDomain" ]
    2.38  
    2.39 @@ -55,7 +53,6 @@ class XendDomain:
    2.40          # So we stuff the XendDomain instance (self) into xroot's components.
    2.41          xroot.add_component("xen.xend.XendDomain", self)
    2.42          self.domains = XendDomainDict()
    2.43 -        # Table of domain info indexed by domain id.
    2.44          self.db = XendDB.XendDB(self.dbpath)
    2.45          eserver.subscribe('xend.virq', self.onVirq)
    2.46          self.initial_refresh()
    2.47 @@ -160,9 +157,9 @@ class XendDomain:
    2.48          info = self.domains.get(id)
    2.49          if info:
    2.50              del self.domains[id]
    2.51 +            self.db.delete(str(id))
    2.52              if notify:
    2.53                  eserver.inject('xend.domain.died', [info.name, info.id])
    2.54 -            self.db.delete(str(id))
    2.55  
    2.56      def reap(self):
    2.57          """Look for domains that have crashed or stopped.
    2.58 @@ -179,11 +176,9 @@ class XendDomain:
    2.59                  casualties.append(d)
    2.60          for d in casualties:
    2.61              id = d['dom']
    2.62 -            #print 'reap>', id
    2.63              dominfo = self.domains.get(id)
    2.64              name = (dominfo and dominfo.name) or '??'
    2.65              if dominfo and dominfo.is_terminated():
    2.66 -                #print 'reap> already terminated:', id
    2.67                  continue
    2.68              log.debug('XendDomain>reap> domain died name=%s id=%d', name, id)
    2.69              if d['shutdown']:
    2.70 @@ -268,6 +263,7 @@ class XendDomain:
    2.71          @return: domain
    2.72          """
    2.73          dominfo = XendDomainInfo.create(config)
    2.74 +        self._add_domain(dominfo)
    2.75          return dominfo
    2.76  
    2.77      def domain_restart(self, dominfo):
    2.78 @@ -296,14 +292,13 @@ class XendDomain:
    2.79          """Configure an existing domain. This is intended for internal
    2.80          use by domain restore and migrate.
    2.81  
    2.82 -        @param id:       domain id
    2.83          @param vmconfig: vm configuration
    2.84          """
    2.85          config = sxp.child_value(vmconfig, 'config')
    2.86          dominfo = XendDomainInfo.restore(config)
    2.87          self._add_domain(dominfo)
    2.88          return dominfo
    2.89 -    
    2.90 +
    2.91      def domain_restore(self, src, progress=False):
    2.92          """Restore a domain from file.
    2.93  
    2.94 @@ -604,7 +599,7 @@ class XendDomain:
    2.95  
    2.96          @param id:   domain id
    2.97          @param devconfig: device configuration
    2.98 -        @param devid:  device index
    2.99 +        @param devid:  device id
   2.100          @return: updated device configuration
   2.101          """
   2.102          dominfo = self.domain_lookup(id)
   2.103 @@ -616,7 +611,7 @@ class XendDomain:
   2.104          """Refresh a device.
   2.105  
   2.106          @param id:  domain id
   2.107 -        @param devid:  device index
   2.108 +        @param devid:  device id
   2.109          @param type: device type
   2.110          """
   2.111          dominfo = self.domain_lookup(id)
   2.112 @@ -628,7 +623,7 @@ class XendDomain:
   2.113          """Destroy a device.
   2.114  
   2.115          @param id:  domain id
   2.116 -        @param devid:  device index
   2.117 +        @param devid:  device id
   2.118          @param type: device type
   2.119          """
   2.120          dominfo = self.domain_lookup(id)
   2.121 @@ -648,10 +643,10 @@ class XendDomain:
   2.122  
   2.123      def domain_devtype_get(self, id, type, devid):
   2.124          """Get a device from a domain.
   2.125 -
   2.126 +        
   2.127          @param id:  domain
   2.128          @param type: device type
   2.129 -        @param devid:  device index
   2.130 +        @param devid:  device id
   2.131          @return: device object (or None)
   2.132          """
   2.133          dominfo = self.domain_lookup(id)
     3.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Mon Jun 06 09:59:18 2005 +0000
     3.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Mon Jun 06 13:04:01 2005 +0000
     3.3 @@ -14,21 +14,20 @@ import time
     3.4  import threading
     3.5  
     3.6  import xen.lowlevel.xc; xc = xen.lowlevel.xc.new()
     3.7 -import xen.util.ip
     3.8 -from xen.xend.server import channel, controller
     3.9 +from xen.util.ip import check_subnet, get_current_ipgw
    3.10  from xen.util.blkif import blkdev_uname_to_file
    3.11  
    3.12 -from server.channel import channelFactory
    3.13 -import server.SrvDaemon; xend = server.SrvDaemon.instance()
    3.14 -from server import messages
    3.15 +from xen.xend.server import channel, controller
    3.16 +from xen.xend.server import SrvDaemon; xend = SrvDaemon.instance()
    3.17 +from xen.xend.server import messages
    3.18 +from xen.xend.server.channel import channelFactory
    3.19  
    3.20 +from xen.xend import sxp
    3.21 +from xen.xend.PrettyPrint import prettyprintstring
    3.22  from xen.xend.XendBootloader import bootloader
    3.23 -import sxp
    3.24 -from XendLogging import log
    3.25 +from xen.xend.XendLogging import log
    3.26  from XendError import XendError, VmError
    3.27 -from XendRoot import get_component
    3.28 -
    3.29 -from PrettyPrint import prettyprintstring
    3.30 +from xen.xend.XendRoot import get_component
    3.31  
    3.32  """Flag for a block device backend domain."""
    3.33  SIF_BLK_BE_DOMAIN = (1<<4)
    3.34 @@ -145,7 +144,6 @@ def add_device_handler(name, type):
    3.35  def get_device_handler(name):
    3.36      return device_handlers[name]
    3.37  
    3.38 -
    3.39  def dom_get(dom):
    3.40      """Get info from xen for an existing domain.
    3.41  
    3.42 @@ -321,7 +319,7 @@ class XendDomainInfo:
    3.43  
    3.44      def __str__(self):
    3.45          s = "domain"
    3.46 -        s += " id=" + self.id
    3.47 +        s += " id=" + str(self.id)
    3.48          s += " name=" + self.name
    3.49          s += " memory=" + str(self.memory)
    3.50          console = self.getConsole()
     4.1 --- a/tools/python/xen/xend/server/SrvDaemon.py	Mon Jun 06 09:59:18 2005 +0000
     4.2 +++ b/tools/python/xen/xend/server/SrvDaemon.py	Mon Jun 06 13:04:01 2005 +0000
     4.3 @@ -32,9 +32,6 @@ import event
     4.4  import relocate
     4.5  from params import *
     4.6  
     4.7 -DAEMONIZE = 0
     4.8 -DEBUG = 1
     4.9 -
    4.10  class Daemon:
    4.11      """The xend daemon.
    4.12      """
     5.1 --- a/tools/python/xen/xend/server/blkif.py	Mon Jun 06 09:59:18 2005 +0000
     5.2 +++ b/tools/python/xen/xend/server/blkif.py	Mon Jun 06 13:04:01 2005 +0000
     5.3 @@ -3,16 +3,16 @@
     5.4  """
     5.5  import string
     5.6  
     5.7 +from xen.util import blkif
     5.8 +from xen.xend.XendError import XendError, VmError
     5.9 +from xen.xend.XendRoot import get_component
    5.10 +from xen.xend.XendLogging import log
    5.11  from xen.xend import sxp
    5.12  from xen.xend import Blkctl
    5.13 -from xen.xend.XendError import XendError, VmError
    5.14 -from xen.xend.XendLogging import log
    5.15 -from xen.util import blkif
    5.16 -from xen.xend.XendRoot import get_component
    5.17  
    5.18 -import channel
    5.19 -from controller import CtrlMsgRcvr, Dev, DevController
    5.20 -from messages import *
    5.21 +from xen.xend.server import channel
    5.22 +from xen.xend.server.controller import CtrlMsgRcvr, Dev, DevController
    5.23 +from xen.xend.server.messages import *
    5.24  
    5.25  class BlkifBackend:
    5.26      """ Handler for the 'back-end' channel to a block device driver domain
     6.1 --- a/tools/python/xen/xend/server/console.py	Mon Jun 06 09:59:18 2005 +0000
     6.2 +++ b/tools/python/xen/xend/server/console.py	Mon Jun 06 13:04:01 2005 +0000
     6.3 @@ -14,9 +14,9 @@ from xen.xend.XendLogging import log
     6.4  from xen.xend import XendRoot; xroot = XendRoot.instance()
     6.5  from xen.xend import sxp
     6.6  
     6.7 -from controller import CtrlMsgRcvr, Dev, DevController
     6.8 -from messages import *
     6.9 -from params import *
    6.10 +from xen.xend.server.controller import CtrlMsgRcvr, Dev, DevController
    6.11 +from xen.xend.server.messages import *
    6.12 +from xen.xend.server.params import *
    6.13  
    6.14  class ConsoleProtocol(protocol.Protocol):
    6.15      """Asynchronous handler for a console socket.
     7.1 --- a/tools/python/xen/xend/server/controller.py	Mon Jun 06 09:59:18 2005 +0000
     7.2 +++ b/tools/python/xen/xend/server/controller.py	Mon Jun 06 13:04:01 2005 +0000
     7.3 @@ -4,7 +4,7 @@ for a domain.
     7.4  """
     7.5  
     7.6  from xen.xend.XendError import XendError
     7.7 -from messages import msgTypeName, printMsg, getMessageType
     7.8 +from xen.xend.server.messages import msgTypeName, printMsg, getMessageType
     7.9  
    7.10  DEBUG = 0
    7.11  
     8.1 --- a/tools/python/xen/xend/server/netif.py	Mon Jun 06 09:59:18 2005 +0000
     8.2 +++ b/tools/python/xen/xend/server/netif.py	Mon Jun 06 13:04:01 2005 +0000
     8.3 @@ -11,9 +11,9 @@ from xen.xend.XendLogging import log
     8.4  from xen.xend import XendVnet
     8.5  from xen.xend.XendRoot import get_component
     8.6  
     8.7 -import channel
     8.8 -from controller import CtrlMsgRcvr, Dev, DevController
     8.9 -from messages import *
    8.10 +from xen.xend.server import channel
    8.11 +from xen.xend.server.controller import CtrlMsgRcvr, Dev, DevController
    8.12 +from xen.xend.server.messages import *
    8.13  
    8.14  class NetDev(Dev):
    8.15      """A network device.
     9.1 --- a/tools/python/xen/xend/server/usbif.py	Mon Jun 06 09:59:18 2005 +0000
     9.2 +++ b/tools/python/xen/xend/server/usbif.py	Mon Jun 06 13:04:01 2005 +0000
     9.3 @@ -8,9 +8,9 @@ from xen.xend import sxp
     9.4  from xen.xend.XendLogging import log
     9.5  from xen.xend.XendError import XendError
     9.6  
     9.7 -import channel
     9.8 -from controller import Dev, DevController
     9.9 -from messages import *
    9.10 +from xen.xend.server import channel
    9.11 +from xen.xend.server.controller import Dev, DevController
    9.12 +from xen.xend.server.messages import *
    9.13  
    9.14  class UsbBackend:
    9.15      """Handler for the 'back-end' channel to a USB device driver domain