[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] xend: Time-out if guest fails to suspend
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1236855652 0 # Node ID db53046ca5f0f1410cfba7ef4d40eb9ea2198d89 # Parent 8401a1f14759ae05877f184fc409f835eb425167 xend: Time-out if guest fails to suspend If a guest fails to re-write control/shutdown node within a minute, fail the suspend operation. Signed-off-by: John Levon <john.levon@xxxxxxx> --- tools/python/xen/xend/XendCheckpoint.py | 2 +- tools/python/xen/xend/XendDomainInfo.py | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff -r 8401a1f14759 -r db53046ca5f0 tools/python/xen/xend/XendCheckpoint.py --- a/tools/python/xen/xend/XendCheckpoint.py Thu Mar 12 10:59:53 2009 +0000 +++ b/tools/python/xen/xend/XendCheckpoint.py Thu Mar 12 11:00:52 2009 +0000 @@ -114,7 +114,7 @@ def save(fd, dominfo, network, live, dst if line == "suspend": log.debug("Suspending %d ...", dominfo.getDomid()) dominfo.shutdown('suspend') - dominfo.waitForShutdown() + dominfo.waitForSuspend() if line in ('suspend', 'suspended'): dominfo.migrateDevices(network, dst, DEV_MIGRATE_STEP2, domain_name) diff -r 8401a1f14759 -r db53046ca5f0 tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Thu Mar 12 10:59:53 2009 +0000 +++ b/tools/python/xen/xend/XendDomainInfo.py Thu Mar 12 11:00:52 2009 +0000 @@ -2544,6 +2544,31 @@ class XendDomainInfo: finally: self.state_updated.release() + def waitForSuspend(self): + """Wait for the guest to respond to a suspend request by + shutting down. If the guest hasn't re-written control/shutdown + after a certain amount of time, it's obviously not listening and + won't suspend, so we give up. HVM guests with no PV drivers + should already be shutdown. + """ + state = "suspend" + nr_tries = 60 + + self.state_updated.acquire() + try: + while self._stateGet() in (DOM_STATE_RUNNING,DOM_STATE_PAUSED): + self.state_updated.wait(1.0) + if state == "suspend": + if nr_tries == 0: + msg = ('Timeout waiting for domain %s to suspend' + % self.domid) + self._writeDom('control/shutdown', '') + raise XendError(msg) + state = self.readDom('control/shutdown') + nr_tries -= 1 + finally: + self.state_updated.release() + # # TODO: recategorise - called from XendCheckpoint # _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |