mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
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>
This commit is contained in:
1 parent
4ac7f7b347
commit
3a2080259e
2 files changed
+11
-29
No files matched your search
@@ -34,7 +34,6 @@ from xen.xend.XendError import XendError
|
||||
from xen.xend.XendLogging import log
|
||||
from xen.xend import scheduler
|
||||
from xen.xend.server import relocate
|
||||
from xen.xend.xenstore import XenNode, DBMap
|
||||
from xen.xend.xenstore.xstransact import xstransact
|
||||
|
||||
|
||||
@@ -68,8 +67,6 @@ class XendDomain:
|
||||
# So we stuff the XendDomain instance (self) into xroot's components.
|
||||
xroot.add_component("xen.xend.XendDomain", self)
|
||||
self.domains = XendDomainDict()
|
||||
self.vmroot = "/domain"
|
||||
self.dbmap = DBMap(db=XenNode(self.vmroot))
|
||||
self.watchReleaseDomain()
|
||||
self.refresh()
|
||||
self.dom0_setup()
|
||||
@@ -174,17 +171,6 @@ class XendDomain:
|
||||
if notify:
|
||||
eserver.inject('xend.domain.died', [info.getName(),
|
||||
info.getDomid()])
|
||||
# XXX this should not be needed
|
||||
for domdb in self.dbmap.values():
|
||||
if not domdb.has_key("xend"):
|
||||
continue
|
||||
db = domdb.addChild("xend")
|
||||
try:
|
||||
domid = int(domdb["domid"].getData())
|
||||
except:
|
||||
domid = None
|
||||
if (domid is None) or (domid == id):
|
||||
domdb.delete()
|
||||
|
||||
|
||||
def refresh(self):
|
||||
@@ -230,7 +216,7 @@ class XendDomain:
|
||||
@param config: configuration
|
||||
@return: domain
|
||||
"""
|
||||
dominfo = XendDomainInfo.create(self.dbmap.getPath(), config)
|
||||
dominfo = XendDomainInfo.create(config)
|
||||
self._add_domain(dominfo)
|
||||
return dominfo
|
||||
|
||||
@@ -247,7 +233,7 @@ class XendDomain:
|
||||
nested = sxp.child_value(config, 'config')
|
||||
if nested:
|
||||
config = nested
|
||||
return XendDomainInfo.restore(self.dbmap.getPath(), config)
|
||||
return XendDomainInfo.restore(config)
|
||||
|
||||
def domain_restore(self, src, progress=False):
|
||||
"""Restore a domain from file.
|
||||
|
||||
@@ -154,17 +154,16 @@ class XendDomainInfo:
|
||||
MINIMUM_RESTART_TIME = 20
|
||||
|
||||
|
||||
def create(cls, dompath, config):
|
||||
def create(cls, config):
|
||||
"""Create a VM from a configuration.
|
||||
|
||||
@param dompath: The path to all domain information
|
||||
@param config configuration
|
||||
@raise: VmError for invalid configuration
|
||||
"""
|
||||
|
||||
log.debug("XendDomainInfo.create(%s, ...)", dompath)
|
||||
log.debug("XendDomainInfo.create(...)")
|
||||
|
||||
vm = cls(getUuid(), dompath, cls.parseConfig(config))
|
||||
vm = cls(getUuid(), cls.parseConfig(config))
|
||||
vm.construct()
|
||||
vm.refreshShutdown()
|
||||
return vm
|
||||
@@ -192,30 +191,27 @@ class XendDomainInfo:
|
||||
raise XendError(
|
||||
'No vm/uuid path in store for existing domain %d' % domid)
|
||||
|
||||
dompath = "/".join(dompath.split("/")[0:-1])
|
||||
except Exception, exn:
|
||||
log.warn(str(exn))
|
||||
dompath = DOMROOT
|
||||
uuid = getUuid()
|
||||
|
||||
log.info("Recreating domain %d, uuid %s", domid, uuid)
|
||||
|
||||
vm = cls(uuid, dompath, xeninfo, domid, True)
|
||||
vm = cls(uuid, xeninfo, domid, True)
|
||||
vm.refreshShutdown(xeninfo)
|
||||
return vm
|
||||
|
||||
recreate = classmethod(recreate)
|
||||
|
||||
|
||||
def restore(cls, dompath, config, uuid = None):
|
||||
def restore(cls, config, uuid = None):
|
||||
"""Create a domain and a VM object to do a restore.
|
||||
|
||||
@param dompath: The path to all domain information
|
||||
@param config: domain configuration
|
||||
@param uuid: uuid to use
|
||||
"""
|
||||
|
||||
log.debug("XendDomainInfo.restore(%s, %s, %s)", dompath, config, uuid)
|
||||
log.debug("XendDomainInfo.restore(%s, %s)", config, uuid)
|
||||
|
||||
if not uuid:
|
||||
uuid = getUuid()
|
||||
@@ -225,7 +221,7 @@ class XendDomainInfo:
|
||||
except TypeError, exn:
|
||||
raise VmError('Invalid ssidref in config: %s' % exn)
|
||||
|
||||
vm = cls(uuid, dompath, cls.parseConfig(config),
|
||||
vm = cls(uuid, cls.parseConfig(config),
|
||||
xc.domain_create(ssidref = ssidref))
|
||||
vm.create_channel()
|
||||
vm.configure()
|
||||
@@ -293,12 +289,12 @@ class XendDomainInfo:
|
||||
parseConfig = classmethod(parseConfig)
|
||||
|
||||
|
||||
def __init__(self, uuid, parentpath, info, domid = None, augment = False):
|
||||
def __init__(self, uuid, info, domid = None, augment = False):
|
||||
|
||||
self.uuid = uuid
|
||||
self.info = info
|
||||
|
||||
self.path = parentpath + "/" + uuid
|
||||
self.path = DOMROOT + "/" + uuid
|
||||
|
||||
if domid:
|
||||
self.domid = domid
|
||||
|
||||