mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 18:21:39 +01:00
bitkeeper revision 1.1159.14.4 (4118d2b68g453DSG6YDQBLmCyvKVgA)
Sundry fixes to domain restore.
This commit is contained in:
1 parent
46ef4b6ecd
commit
103f4e1670
4 files changed
+13
-6
No files matched your search
@@ -375,7 +375,7 @@ class XendDomain:
|
||||
def cbok(dominfo):
|
||||
self._add_domain(dominfo)
|
||||
return dominfo
|
||||
deferred = dominfo.construct(config)
|
||||
deferred = dominfo.dom_construct(dominfo.dom, config)
|
||||
deferred.addCallback(cbok)
|
||||
return deferred
|
||||
|
||||
|
||||
@@ -295,7 +295,6 @@ def vm_restore(src, progress=0):
|
||||
raises VmError for invalid configuration
|
||||
"""
|
||||
vm = XendDomainInfo()
|
||||
vm.restore = 1
|
||||
ostype = "linux" #todo Set from somewhere (store in the src?).
|
||||
restorefn = getattr(xc, "%s_restore" % ostype)
|
||||
d = restorefn(state_file=src, progress=progress)
|
||||
@@ -304,11 +303,10 @@ def vm_restore(src, progress=0):
|
||||
raise VmError('restore failed')
|
||||
try:
|
||||
vmconfig = sxp.from_string(d['vmconfig'])
|
||||
vm.config = sxp.child_value(vmconfig, 'config')
|
||||
config = sxp.child_value(vmconfig, 'config')
|
||||
except Exception, ex:
|
||||
raise VmError('config error: ' + str(ex))
|
||||
deferred = vm.dom_construct(dom)
|
||||
vm.restore = 0
|
||||
deferred = vm.dom_construct(dom, config)
|
||||
def vifs_cb(val, vm):
|
||||
vif_up(vm.ipaddrs)
|
||||
deferred.addCallback(vifs_cb, vm)
|
||||
@@ -930,7 +928,7 @@ class XendDomainInfo:
|
||||
d.addCallback(_vm_configure1, self)
|
||||
return d
|
||||
|
||||
def dom_construct(self, dom):
|
||||
def dom_construct(self, dom, config):
|
||||
"""Construct a vm for an existing domain.
|
||||
|
||||
@param dom: domain id
|
||||
@@ -940,6 +938,8 @@ class XendDomainInfo:
|
||||
if not d:
|
||||
raise VmError("Domain not found: %d" % dom)
|
||||
try:
|
||||
self.config = config
|
||||
self.restore = 1
|
||||
self.setdom(dom)
|
||||
self.name = d['name']
|
||||
self.memory = d['memory']/1024
|
||||
@@ -948,6 +948,7 @@ class XendDomainInfo:
|
||||
self.destroy()
|
||||
return err
|
||||
deferred.addErrback(cberr)
|
||||
self.restore = 0
|
||||
except StandardError, ex:
|
||||
self.destroy()
|
||||
raise
|
||||
|
||||
@@ -290,6 +290,9 @@ class ProgRestore(Prog):
|
||||
savefile = os.path.abspath(args[1])
|
||||
info = server.xend_domain_restore(savefile)
|
||||
PrettyPrint.prettyprint(info)
|
||||
id = sxp.child_value(info, 'id')
|
||||
if id is not None:
|
||||
server.xend_domain_unpause(id)
|
||||
|
||||
xm.prog(ProgRestore)
|
||||
|
||||
|
||||