Implement clean return from save/restore failure (so that original

domain can continue execution).
Signed-off-by: Andrei Petrov <andrei.petrov@xensource.com>
This commit is contained in:
kfraser@localhost.localdomain committed 2007-01-22 15:15:32 +00:00
1 parent b6d2434d38
commit f4e8a7e419
6 files changed
+200 -23

No files matched your search

+2 -2
View File
@@ -1064,9 +1064,9 @@ static PyMethodDef pyxc_methods[] = {
"Destroy a domain.\n"
" dom [int]: Identifier of domain to be destroyed.\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{ "domain_resume",
(PyCFunction)pyxc_domain_resume,
(PyCFunction)pyxc_domain_resume,
METH_VARARGS, "\n"
"Resume execution of a suspended domain.\n"
" dom [int]: Identifier of domain to be resumed.\n\n"
+23 -1
View File
@@ -122,6 +122,8 @@ def save(fd, dominfo, network, live, dst):
os.remove("/tmp/xen.qemu-dm.%d" % dominfo.getDomid())
dominfo.destroyDomain()
dominfo.testDeviceComplete()
try:
dominfo.setName(domain_name)
except VmError:
@@ -134,11 +136,31 @@ def save(fd, dominfo, network, live, dst):
except Exception, exn:
log.exception("Save failed on domain %s (%s).", domain_name,
dominfo.getDomid())
dominfo._releaseDevices()
dominfo.testDeviceComplete()
dominfo.testvifsComplete()
log.debug("XendCheckpoint.save: devices released")
dominfo._resetChannels()
dominfo._removeDom('control/shutdown')
dominfo._removeDom('device-misc/vif/nextDeviceID')
dominfo._createChannels()
dominfo._introduceDomain()
dominfo._storeDomDetails()
dominfo._createDevices()
log.debug("XendCheckpoint.save: devices created")
dominfo.resumeDomain()
log.debug("XendCheckpoint.save: resumeDomain")
try:
dominfo.setName(domain_name)
except:
log.exception("Failed to reset the migrating domain's name")
raise Exception, exn
def restore(xd, fd, dominfo = None, paused = False):
-1
View File
@@ -1166,7 +1166,6 @@ class XendDomain:
sock.send("receive\n")
sock.recv(80)
XendCheckpoint.save(sock.fileno(), dominfo, True, live, dst)
dominfo.testDeviceComplete()
sock.close()
def domain_save(self, domid, dst):
+29
View File
@@ -1580,6 +1580,16 @@ class XendDomainInfo:
log.exception("Exception in alloc_unbound(%d)", self.domid)
raise
def _resetChannels(self):
"""Reset all event channels in the domain.
"""
try:
return xc.evtchn_reset(dom=self.domid)
except:
log.exception("Exception in evtcnh_reset(%d)", self.domid)
raise
#
# Bootloader configuration
#
@@ -1737,6 +1747,25 @@ class XendDomainInfo:
log.info("Dev still active but hit max loop timeout")
break
def testvifsComplete(self):
""" In case vifs are released and then created for the same
domain, we need to wait the device shut down.
"""
start = time.time()
while True:
test = 0
diff = time.time() - start
for i in self.getDeviceController('vif').deviceIDs():
test = 1
log.info("Dev %s still active, looping...", i)
time.sleep(0.1)
if test == 0:
break
if diff >= MIGRATE_TIMEOUT:
log.info("Dev still active but hit max loop timeout")
break
def _storeVmDetails(self):
to_store = {}
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.