diff options
author | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2007-09-14 16:07:18 +0100 |
---|---|---|
committer | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2007-09-14 16:07:18 +0100 |
commit | e1a067a78e492fd5806a6e884764fcb08a3d1bb8 (patch) | |
tree | 13fff7fa5de14e1e8f2603839c3a5f4a6f6c87a4 | |
parent | 661e422af8358828daf1f83467375ae991f00e75 (diff) | |
download | xen-e1a067a78e492fd5806a6e884764fcb08a3d1bb8.tar.gz xen-e1a067a78e492fd5806a6e884764fcb08a3d1bb8.tar.bz2 xen-e1a067a78e492fd5806a6e884764fcb08a3d1bb8.zip |
Fix xm dump-core command for paused domain.
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
-rw-r--r-- | tools/python/xen/xend/XendDomain.py | 15 | ||||
-rw-r--r-- | tools/python/xen/xm/main.py | 4 |
2 files changed, 13 insertions, 6 deletions
diff --git a/tools/python/xen/xend/XendDomain.py b/tools/python/xen/xend/XendDomain.py index 6ceea45e08..5e09126bb2 100644 --- a/tools/python/xen/xend/XendDomain.py +++ b/tools/python/xen/xend/XendDomain.py @@ -1176,12 +1176,16 @@ class XendDomain: log.exception("domain_unpause") raise XendError(str(ex)) - def domain_pause(self, domid): + def domain_pause(self, domid, state=False): """Pause domain execution. @param domid: Domain ID or Name @type domid: int or string. - @rtype: None + @keyword state: If True, will return the domain state before pause + @type state: bool + @rtype: int if state is True + @return: Domain state (DOM_STATE_*) + @rtype: None if state is False @raise XendError: Failed to pause @raise XendInvalidDomain: Domain is not valid """ @@ -1191,13 +1195,16 @@ class XendDomain: raise XendInvalidDomain(str(domid)) if dominfo.getDomid() == DOM0_ID: raise XendError("Cannot pause privileged domain %s" % domid) - if dominfo._stateGet() not in (DOM_STATE_RUNNING, DOM_STATE_PAUSED): + ds = dominfo._stateGet() + if ds not in (DOM_STATE_RUNNING, DOM_STATE_PAUSED): raise VMBadState("Domain '%s' is not started" % domid, POWER_STATE_NAMES[DOM_STATE_RUNNING], - POWER_STATE_NAMES[dominfo._stateGet()]) + POWER_STATE_NAMES[ds]) log.info("Domain %s (%d) paused.", dominfo.getName(), int(dominfo.getDomid())) dominfo.pause() + if state: + return ds except XendInvalidDomain: log.exception("domain_pause") raise diff --git a/tools/python/xen/xm/main.py b/tools/python/xen/xm/main.py index 8473f8bf5b..76f5d2a50b 100644 --- a/tools/python/xen/xm/main.py +++ b/tools/python/xen/xm/main.py @@ -1287,13 +1287,13 @@ def xm_dump_core(args): filename = None if not live: - server.xend.domain.pause(dom) + ds = server.xend.domain.pause(dom, True) try: print "Dumping core of domain: %s ..." % str(dom) server.xend.domain.dump(dom, filename, live, crash) finally: - if not live: + if not live and ds == DOM_STATE_RUNNING: server.xend.domain.unpause(dom) if crash: |