mirror of
https://github.com/xen-project/xen.git
synced 2026-10-30 03:00:05 +01:00
A number of changes to get save-restore working again:
Fix the use of configuration inside domain_configure. The config written by XendDomainInfo.sxpr has moved, and this function needs to change to match. Re-add a call to _add_domain inside domain_restore. Inside XendDomainInfo.restore, perform the appropriate configuration to restore the domain. Validate maxmem_KiB, and cap it at memory_KiB if over that value. Save requires that value to be correct, as the logic for saving only the pages in use is not in place inside Xen. Output the device configuration in sxpr(), as required for save-restore. Check for image being null when trying to call createDeviceModel -- configure is called on restore as well as create, and the ImageHandler instance is not present in the former. Remove dead code create_blkif. Signed-off-by: Ewan Mellor <ewan@xensource.com>
This commit is contained in:
1 parent
6c2a23bb96
commit
9f70470c55
2 files changed
+18
-15
No files matched your search
@@ -299,13 +299,12 @@ class XendDomain:
|
||||
[dominfo.getName(), dominfo.getDomain(), "fail"])
|
||||
return dominfo
|
||||
|
||||
def domain_configure(self, vmconfig):
|
||||
def domain_configure(self, config):
|
||||
"""Configure an existing domain. This is intended for internal
|
||||
use by domain restore and migrate.
|
||||
|
||||
@param vmconfig: vm configuration
|
||||
"""
|
||||
config = sxp.child_value(vmconfig, 'config')
|
||||
return XendDomainInfo.restore(self.dbmap.getPath(), config)
|
||||
|
||||
def domain_restore(self, src, progress=False):
|
||||
@@ -317,7 +316,9 @@ class XendDomain:
|
||||
|
||||
try:
|
||||
fd = os.open(src, os.O_RDONLY)
|
||||
return XendCheckpoint.restore(self, fd)
|
||||
dominfo = XendCheckpoint.restore(self, fd)
|
||||
self._add_domain(dominfo)
|
||||
return dominfo
|
||||
except OSError, ex:
|
||||
raise XendError("can't read guest state file %s: %s" %
|
||||
(src, ex[1]))
|
||||
@@ -502,7 +503,7 @@ class XendDomain:
|
||||
"""
|
||||
|
||||
if domid == PRIV_DOMAIN:
|
||||
raise XendError("Cannot destroy priviliged domain %i" % domid)
|
||||
raise XendError("Cannot destroy privileged domain %i" % domid)
|
||||
|
||||
self.domain_restart_schedule(domid, reason, force=True)
|
||||
dominfo = self.domain_lookup(domid)
|
||||
|
||||
@@ -172,7 +172,7 @@ class XendDomainInfo:
|
||||
@param uuid: uuid to use
|
||||
"""
|
||||
|
||||
log.debug("XendDomainInfo.restore(%s, ..., %s)", dompath, uuid)
|
||||
log.debug("XendDomainInfo.restore(%s, %s, %s)", dompath, config, uuid)
|
||||
|
||||
if not uuid:
|
||||
uuid = getUuid()
|
||||
@@ -187,6 +187,9 @@ class XendDomainInfo:
|
||||
vm = cls(uuid, dompath, cls.parseConfig(config),
|
||||
xc.domain_create(ssidref = ssidref))
|
||||
vm.clear_shutdown()
|
||||
vm.create_channel()
|
||||
vm.configure()
|
||||
vm.exportToDB()
|
||||
return vm
|
||||
|
||||
restore = classmethod(restore)
|
||||
@@ -382,6 +385,9 @@ class XendDomainInfo:
|
||||
if not self.info['maxmem_KiB']:
|
||||
self.info['maxmem_KiB'] = 1 << 30
|
||||
|
||||
if self.info['maxmem_KiB'] > self.info['memory_KiB']:
|
||||
self.info['maxmem_KiB'] = self.info['memory_KiB']
|
||||
|
||||
# Validate the given backend names.
|
||||
for s in self.info['backend']:
|
||||
if s not in backendFlags:
|
||||
@@ -607,6 +613,10 @@ class XendDomainInfo:
|
||||
if self.info:
|
||||
sxpr.append(['maxmem', self.info['maxmem_KiB'] / 1024])
|
||||
|
||||
if self.infoIsSet('device'):
|
||||
for (n, c) in self.info['device']:
|
||||
sxpr.append(['device', c])
|
||||
|
||||
def stateChar(name):
|
||||
if name in self.info:
|
||||
if self.info[name]:
|
||||
@@ -864,7 +874,8 @@ class XendDomainInfo:
|
||||
"""
|
||||
if not self.rebooting():
|
||||
self.create_configured_devices()
|
||||
self.image.createDeviceModel()
|
||||
if self.image:
|
||||
self.image.createDeviceModel()
|
||||
|
||||
def device_create(self, dev_config):
|
||||
"""Create a new device.
|
||||
@@ -979,15 +990,6 @@ class XendDomainInfo:
|
||||
"""
|
||||
self.configure_maxmem()
|
||||
self.create_devices()
|
||||
self.create_blkif()
|
||||
|
||||
def create_blkif(self):
|
||||
"""Create the block device interface (blkif) for the vm.
|
||||
The vm needs a blkif even if it doesn't have any disks
|
||||
at creation time, for example when it uses NFS root.
|
||||
|
||||
"""
|
||||
return
|
||||
|
||||
|
||||
def configure_maxmem(self):
|
||||
|
||||