Change the semantics of GetDomainPath so that it always succeeds, regardless of

whether a domain has been introduced to the store.  Added a separate message
XS_IS_DOMAIN_INTRODUCED and API for that (xs_is_domain_introduced) to determine
whether the domain has really been introduced.  This change means that the
tools can determine the correct domain path earlier in the domain creation
process, which is particularly a factor with live migration, as it allows us
to create the devices earlier in the process, and unpause the new domain before
performing the introduce.  Until recently we already had these features, but
the simplification of the interface between xend and xenstored caused breakage.

No longer clear out the domain path when a domain is introduced -- this was a
hack to work around the recent problematic semantics of GetDomainPath.

Do not write the contents of the info block to the store.  All the configuration
info is written to the /vm path, and anything else in the info block is either
dealt with explicitly or is ephemeral and has no place in the store.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
This commit is contained in:
emellor@leeni.uk.xensource.com committed 2005-10-23 22:45:15 +01:00
1 parent 4384b3fc70
commit fea7782321
11 files changed
+75 -51

No files matched your search

+1 -2
View File
@@ -795,11 +795,10 @@ static PyObject *xspy_close(PyObject *self, PyObject *args, PyObject *kwds)
}
#define xspy_get_domain_path_doc "\n" \
"Return store path of domain.\n" \
"Return store path of domain, whether or not the domain exists.\n" \
" domid [int]: domain id\n" \
"\n" \
"Returns: [string] domain store path.\n" \
" None if domid doesn't exist.\n" \
"Raises RuntimeError on error.\n" \
"\n"
+2
View File
@@ -144,6 +144,8 @@ def restore(xd, fd):
if handler.store_mfn is None or handler.console_mfn is None:
raise XendError('Could not read store/console MFN')
dominfo.unpause()
dominfo.completeRestore(handler.store_mfn, handler.console_mfn)
return dominfo
+17 -19
View File
@@ -198,7 +198,7 @@ def recreate(xeninfo, priv):
vm = XendDomainInfo(xeninfo, domid, dompath, True)
except Exception, exn:
if True:
if priv:
log.warn(str(exn))
vm = XendDomainInfo(xeninfo, domid, dompath, True)
@@ -223,7 +223,9 @@ def restore(config):
try:
vm.construct()
vm.storeVmDetails()
vm.createDevices()
vm.createChannels()
vm.storeDomDetails()
return vm
except:
vm.destroy()
@@ -337,8 +339,8 @@ def dom_get(dom):
log.debug("domain_getinfo(%d) failed, ignoring: %s", dom, str(err))
return None
class XendDomainInfo:
class XendDomainInfo:
def __init__(self, info, domid = None, dompath = None, augment = False):
@@ -558,13 +560,13 @@ class XendDomainInfo:
def completeRestore(self, store_mfn, console_mfn):
log.debug("XendDomainInfo.completeRestore")
self.store_mfn = store_mfn
self.console_mfn = console_mfn
self.introduceDomain()
self.create_devices()
self.storeDomDetails()
self.unpause()
self.refreshShutdown()
@@ -597,10 +599,6 @@ class XendDomainInfo:
'memory/target': str(self.info['memory_KiB'])
}
for (k, v) in self.info.items():
if v:
to_store[k] = str(v)
def f(n, v):
if v is not None:
to_store[n] = str(v)
@@ -1055,6 +1053,10 @@ class XendDomainInfo:
raise VmError('Creating domain failed: name=%s' %
self.info['name'])
self.dompath = GetDomainPath(self.domid)
self.removeDom()
# Set maximum number of vcpus in domain
xc.domain_max_vcpus(self.domid, int(self.info['vcpus']))
@@ -1065,8 +1067,6 @@ class XendDomainInfo:
assert self.store_port is not None
IntroduceDomain(self.domid, self.store_mfn, self.store_port)
self.dompath = GetDomainPath(self.domid)
assert self.dompath
def initDomain(self):
@@ -1105,7 +1105,7 @@ class XendDomainInfo:
self.introduceDomain()
self.create_devices()
self.createDevices()
self.info['start_time'] = time.time()
@@ -1209,23 +1209,21 @@ class XendDomainInfo:
raise
def create_configured_devices(self):
for (n, c) in self.info['device']:
self.createDevice(n, c)
## public:
def create_devices(self):
def createDevices(self):
"""Create the devices for a vm.
@raise: VmError for invalid devices
"""
self.create_configured_devices()
for (n, c) in self.info['device']:
self.createDevice(n, c)
if self.image:
self.image.createDeviceModel()
## public:
def device_create(self, dev_config):
"""Create a new device.
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.