ia64/xen-unstable

changeset 15912:9a7cbde124a5

Fix xm dump-core command for paused domain.
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
author kfraser@localhost.localdomain
date Fri Sep 14 16:07:18 2007 +0100 (2007-09-14)
parents 9f4f70233041
children 0349e4eedd25
files tools/python/xen/xend/XendDomain.py tools/python/xen/xm/main.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomain.py	Fri Sep 14 16:05:39 2007 +0100
     1.2 +++ b/tools/python/xen/xend/XendDomain.py	Fri Sep 14 16:07:18 2007 +0100
     1.3 @@ -1176,12 +1176,16 @@ class XendDomain:
     1.4              log.exception("domain_unpause")
     1.5              raise XendError(str(ex))
     1.6  
     1.7 -    def domain_pause(self, domid):
     1.8 +    def domain_pause(self, domid, state=False):
     1.9          """Pause domain execution.
    1.10  
    1.11          @param domid: Domain ID or Name
    1.12          @type domid: int or string.
    1.13 -        @rtype: None
    1.14 +        @keyword state: If True, will return the domain state before pause
    1.15 +        @type state: bool
    1.16 +        @rtype: int if state is True
    1.17 +        @return: Domain state (DOM_STATE_*)
    1.18 +        @rtype: None if state is False
    1.19          @raise XendError: Failed to pause
    1.20          @raise XendInvalidDomain: Domain is not valid
    1.21          """        
    1.22 @@ -1191,13 +1195,16 @@ class XendDomain:
    1.23                  raise XendInvalidDomain(str(domid))
    1.24              if dominfo.getDomid() == DOM0_ID:
    1.25                  raise XendError("Cannot pause privileged domain %s" % domid)
    1.26 -            if dominfo._stateGet() not in (DOM_STATE_RUNNING, DOM_STATE_PAUSED):
    1.27 +            ds = dominfo._stateGet()
    1.28 +            if ds not in (DOM_STATE_RUNNING, DOM_STATE_PAUSED):
    1.29                  raise VMBadState("Domain '%s' is not started" % domid,
    1.30                                   POWER_STATE_NAMES[DOM_STATE_RUNNING],
    1.31 -                                 POWER_STATE_NAMES[dominfo._stateGet()])
    1.32 +                                 POWER_STATE_NAMES[ds])
    1.33              log.info("Domain %s (%d) paused.", dominfo.getName(),
    1.34                       int(dominfo.getDomid()))
    1.35              dominfo.pause()
    1.36 +            if state:
    1.37 +                return ds
    1.38          except XendInvalidDomain:
    1.39              log.exception("domain_pause")
    1.40              raise
     2.1 --- a/tools/python/xen/xm/main.py	Fri Sep 14 16:05:39 2007 +0100
     2.2 +++ b/tools/python/xen/xm/main.py	Fri Sep 14 16:07:18 2007 +0100
     2.3 @@ -1287,13 +1287,13 @@ def xm_dump_core(args):
     2.4          filename = None
     2.5  
     2.6      if not live:
     2.7 -        server.xend.domain.pause(dom)
     2.8 +        ds = server.xend.domain.pause(dom, True)
     2.9  
    2.10      try:
    2.11          print "Dumping core of domain: %s ..." % str(dom)
    2.12          server.xend.domain.dump(dom, filename, live, crash)
    2.13      finally:
    2.14 -        if not live:
    2.15 +        if not live and ds == DOM_STATE_RUNNING:
    2.16              server.xend.domain.unpause(dom)
    2.17  
    2.18      if crash: