ia64/xen-unstable

changeset 7075:a8ed2f186c23

Remove DBMap etc from XendDomainInfo, moving the handling of the domain root
and VM root totally into XendDomainInfo. The DBMap stuff was all cruft,
following the move to xstransact. Removing it may also help those suffering
from poor start-up times caused by a large store.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@ewan
date Tue Sep 27 14:49:31 2005 +0100 (2005-09-27)
parents 63f06da6c5b0
children 9575efe88e75
files tools/python/xen/xend/XendDomain.py tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomain.py	Tue Sep 27 14:36:58 2005 +0100
     1.2 +++ b/tools/python/xen/xend/XendDomain.py	Tue Sep 27 14:49:31 2005 +0100
     1.3 @@ -34,7 +34,6 @@ from xen.xend.XendError import XendError
     1.4  from xen.xend.XendLogging import log
     1.5  from xen.xend import scheduler
     1.6  from xen.xend.server import relocate
     1.7 -from xen.xend.xenstore import XenNode, DBMap
     1.8  from xen.xend.xenstore.xstransact import xstransact
     1.9  
    1.10  
    1.11 @@ -68,8 +67,6 @@ class XendDomain:
    1.12          # So we stuff the XendDomain instance (self) into xroot's components.
    1.13          xroot.add_component("xen.xend.XendDomain", self)
    1.14          self.domains = XendDomainDict()
    1.15 -        self.vmroot = "/domain"
    1.16 -        self.dbmap = DBMap(db=XenNode(self.vmroot))
    1.17          self.watchReleaseDomain()
    1.18          self.refresh()
    1.19          self.dom0_setup()
    1.20 @@ -174,17 +171,6 @@ class XendDomain:
    1.21              if notify:
    1.22                  eserver.inject('xend.domain.died', [info.getName(),
    1.23                                                      info.getDomid()])
    1.24 -        # XXX this should not be needed
    1.25 -        for domdb in self.dbmap.values():
    1.26 -            if not domdb.has_key("xend"):
    1.27 -                continue
    1.28 -            db = domdb.addChild("xend")
    1.29 -            try:
    1.30 -                domid = int(domdb["domid"].getData())
    1.31 -            except:
    1.32 -                domid = None
    1.33 -            if (domid is None) or (domid == id):
    1.34 -                domdb.delete()
    1.35  
    1.36  
    1.37      def refresh(self):
    1.38 @@ -230,7 +216,7 @@ class XendDomain:
    1.39          @param config: configuration
    1.40          @return: domain
    1.41          """
    1.42 -        dominfo = XendDomainInfo.create(self.dbmap.getPath(), config)
    1.43 +        dominfo = XendDomainInfo.create(config)
    1.44          self._add_domain(dominfo)
    1.45          return dominfo
    1.46  
    1.47 @@ -247,7 +233,7 @@ class XendDomain:
    1.48          nested = sxp.child_value(config, 'config')
    1.49          if nested:
    1.50              config = nested
    1.51 -        return XendDomainInfo.restore(self.dbmap.getPath(), config)
    1.52 +        return XendDomainInfo.restore(config)
    1.53  
    1.54      def domain_restore(self, src, progress=False):
    1.55          """Restore a domain from file.
     2.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Tue Sep 27 14:36:58 2005 +0100
     2.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Tue Sep 27 14:49:31 2005 +0100
     2.3 @@ -154,17 +154,16 @@ class XendDomainInfo:
     2.4      MINIMUM_RESTART_TIME = 20
     2.5  
     2.6  
     2.7 -    def create(cls, dompath, config):
     2.8 +    def create(cls, config):
     2.9          """Create a VM from a configuration.
    2.10  
    2.11 -        @param dompath:   The path to all domain information
    2.12          @param config    configuration
    2.13          @raise: VmError for invalid configuration
    2.14          """
    2.15  
    2.16 -        log.debug("XendDomainInfo.create(%s, ...)", dompath)
    2.17 +        log.debug("XendDomainInfo.create(...)")
    2.18          
    2.19 -        vm = cls(getUuid(), dompath, cls.parseConfig(config))
    2.20 +        vm = cls(getUuid(), cls.parseConfig(config))
    2.21          vm.construct()
    2.22          vm.refreshShutdown()
    2.23          return vm
    2.24 @@ -192,30 +191,27 @@ class XendDomainInfo:
    2.25                  raise XendError(
    2.26                      'No vm/uuid path in store for existing domain %d' % domid)
    2.27  
    2.28 -            dompath = "/".join(dompath.split("/")[0:-1])
    2.29          except Exception, exn:
    2.30              log.warn(str(exn))
    2.31 -            dompath = DOMROOT
    2.32              uuid = getUuid()
    2.33  
    2.34          log.info("Recreating domain %d, uuid %s", domid, uuid)
    2.35  
    2.36 -        vm = cls(uuid, dompath, xeninfo, domid, True)
    2.37 +        vm = cls(uuid, xeninfo, domid, True)
    2.38          vm.refreshShutdown(xeninfo)
    2.39          return vm
    2.40  
    2.41      recreate = classmethod(recreate)
    2.42  
    2.43  
    2.44 -    def restore(cls, dompath, config, uuid = None):
    2.45 +    def restore(cls, config, uuid = None):
    2.46          """Create a domain and a VM object to do a restore.
    2.47  
    2.48 -        @param dompath:   The path to all domain information
    2.49          @param config:    domain configuration
    2.50          @param uuid:      uuid to use
    2.51          """
    2.52          
    2.53 -        log.debug("XendDomainInfo.restore(%s, %s, %s)", dompath, config, uuid)
    2.54 +        log.debug("XendDomainInfo.restore(%s, %s)", config, uuid)
    2.55  
    2.56          if not uuid:
    2.57              uuid = getUuid()
    2.58 @@ -225,7 +221,7 @@ class XendDomainInfo:
    2.59          except TypeError, exn:
    2.60              raise VmError('Invalid ssidref in config: %s' % exn)
    2.61  
    2.62 -        vm = cls(uuid, dompath, cls.parseConfig(config),
    2.63 +        vm = cls(uuid, cls.parseConfig(config),
    2.64                   xc.domain_create(ssidref = ssidref))
    2.65          vm.create_channel()
    2.66          vm.configure()
    2.67 @@ -293,12 +289,12 @@ class XendDomainInfo:
    2.68      parseConfig = classmethod(parseConfig)
    2.69  
    2.70      
    2.71 -    def __init__(self, uuid, parentpath, info, domid = None, augment = False):
    2.72 +    def __init__(self, uuid, info, domid = None, augment = False):
    2.73  
    2.74          self.uuid = uuid
    2.75          self.info = info
    2.76  
    2.77 -        self.path = parentpath + "/" + uuid
    2.78 +        self.path = DOMROOT + "/" + uuid
    2.79  
    2.80          if domid:
    2.81              self.domid = domid