[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] When suspending and resuming, look up the managed path using the domain's UUID.
# HG changeset patch # User Ewan Mellor <ewan@xxxxxxxxxxxxx> # Node ID 445db3980f61c7eaf613abb5763ac3416be1a28d # Parent 1c09d1d195e7f7249a622c4fd77fe58c524d8db9 When suspending and resuming, look up the managed path using the domain's UUID. Add a resumed domain to the self.domains list after XendCheckpoint.restore, to ensure that it does not get recreated immediately afterwards. Perform domain_resume under the domains_lock, given that the domain needs to be added. These fixes together should fix xm suspend and xm resume. Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx> --- tools/python/xen/xend/XendDomain.py | 75 +++++++++++++++++++----------------- 1 files changed, 41 insertions(+), 34 deletions(-) diff -r 1c09d1d195e7 -r 445db3980f61 tools/python/xen/xend/XendDomain.py --- a/tools/python/xen/xend/XendDomain.py Mon Nov 27 14:48:38 2006 +0000 +++ b/tools/python/xen/xend/XendDomain.py Mon Nov 27 14:52:41 2006 +0000 @@ -564,8 +564,7 @@ class XendDomain: log.debug('Shutting down domain: %s' % dom.getName()) dom.shutdown("poweroff") elif shutdownAction == 'suspend': - chkfile = self._managed_check_point_path(dom.getName()) - self.domain_save(dom.domid, chkfile) + self.domain_suspend(dom.getName()) finally: self.domains_lock.release() @@ -751,11 +750,13 @@ class XendDomain: if dominfo.state != DOM_STATE_RUNNING: raise XendError("Cannot suspend domain that is not running.") - if not os.path.exists(self._managed_config_path(domname)): + dom_uuid = dominfo.get_uuid() + + if not os.path.exists(self._managed_config_path(dom_uuid)): raise XendError("Domain is not managed by Xend lifecycle " + "support.") - - path = self._managed_check_point_path(domname) + + path = self._managed_check_point_path(dom_uuid) fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC) try: # For now we don't support 'live checkpoint' @@ -774,36 +775,42 @@ class XendDomain: @rtype: None @raise XendError: If failed to restore. """ - try: - dominfo = self.domain_lookup_nr(domname) - - if not dominfo: - raise XendInvalidDomain(domname) - - if dominfo.getDomid() == DOM0_ID: - raise XendError("Cannot save privileged domain %s" % domname) - - if dominfo.state != DOM_STATE_HALTED: - raise XendError("Cannot suspend domain that is not running.") - - chkpath = self._managed_check_point_path(domname) - if not os.path.exists(chkpath): - raise XendError("Domain was not suspended by Xend") - - # Restore that replaces the existing XendDomainInfo + self.domains_lock.acquire() + try: try: - log.debug('Current DomainInfo state: %d' % dominfo.state) - XendCheckpoint.restore(self, - os.open(chkpath, os.O_RDONLY), - dominfo) - os.unlink(chkpath) - except OSError, ex: - raise XendError("Failed to read stored checkpoint file") - except IOError, ex: - raise XendError("Failed to delete checkpoint file") - except Exception, ex: - log.exception("Exception occurred when resuming") - raise XendError("Error occurred when resuming: %s" % str(ex)) + dominfo = self.domain_lookup_nr(domname) + + if not dominfo: + raise XendInvalidDomain(domname) + + if dominfo.getDomid() == DOM0_ID: + raise XendError("Cannot save privileged domain %s" % domname) + + if dominfo.state != DOM_STATE_HALTED: + raise XendError("Cannot suspend domain that is not running.") + + dom_uuid = dominfo.get_uuid() + chkpath = self._managed_check_point_path(dom_uuid) + if not os.path.exists(chkpath): + raise XendError("Domain was not suspended by Xend") + + # Restore that replaces the existing XendDomainInfo + try: + log.debug('Current DomainInfo state: %d' % dominfo.state) + XendCheckpoint.restore(self, + os.open(chkpath, os.O_RDONLY), + dominfo) + self._add_domain(dominfo) + os.unlink(chkpath) + except OSError, ex: + raise XendError("Failed to read stored checkpoint file") + except IOError, ex: + raise XendError("Failed to delete checkpoint file") + except Exception, ex: + log.exception("Exception occurred when resuming") + raise XendError("Error occurred when resuming: %s" % str(ex)) + finally: + self.domains_lock.release() def domain_create(self, config): _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |