xend: Fix domain core-dumping about reset option
authorKeir Fraser <keir.fraser@citrix.com>
Fri, 13 Mar 2009 07:38:05 +0000 (07:38 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Fri, 13 Mar 2009 07:38:05 +0000 (07:38 +0000)
This patch moves a call processing of a domain reset processing
from xm to xend.  Also, it adds a reset argument to do_dump() of
SrvDomain.py.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
tools/python/xen/xend/XendDomain.py
tools/python/xen/xend/server/SrvDomain.py
tools/python/xen/xm/main.py

index bba98f596b831f9bc0aecb1465d85933a46a638e..b624f786ad160c2cc35b5ebbd66b3cf561ddf390 100644 (file)
@@ -1223,7 +1223,7 @@ class XendDomain:
             log.exception("domain_pause")
             raise XendError(str(ex))
 
-    def domain_dump(self, domid, filename, live, crash):
+    def domain_dump(self, domid, filename=None, live=False, crash=False, reset=False):
         """Dump domain core."""
 
         dominfo = self.domain_lookup_nr(domid)
@@ -1244,15 +1244,17 @@ class XendDomain:
         try:
             try:
                 log.info("Domain core dump requested for domain %s (%d) "
-                         "live=%d crash=%d.",
-                         dominfo.getName(), dominfo.getDomid(), live, crash)
+                         "live=%d crash=%d reset=%d.",
+                         dominfo.getName(), dominfo.getDomid(), live, crash, reset)
                 dominfo.dumpCore(filename)
                 if crash:
                     self.domain_destroy(domid)
+                elif reset:
+                    self.domain_reset(domid)
             except Exception, ex:
                 raise XendError(str(ex))
         finally:
-            if dopause and not crash:
+            if dopause and not crash and not reset:
                 dominfo.unpause()
 
     def domain_destroy(self, domid):
index 531b02e5cf79771e813c863f28f2435463aab01d..b76c7b365235b79e9c5145990642591c3e32d61b 100644 (file)
@@ -104,7 +104,8 @@ class SrvDomain(SrvDir):
                     [['dom',         'int'],
                      ['file',        'str'],
                      ['live',        'int'],
-                     ['crash',       'int']])
+                     ['crash',       'int'],
+                     ['reset',       'int']])
         return fn(req.args, {'dom': self.dom.domid})
 
     def op_migrate(self, op, req):
index c8bf32174cea1d58217b7dfc520f0c576efed77e..c7bc21e523c0fe33ef6b732b7afd53623711accc 100644 (file)
@@ -1352,9 +1352,7 @@ def xm_dump_core(args):
         filename = None
 
     print "Dumping core of domain: %s ..." % str(dom)
-    server.xend.domain.dump(dom, filename, live, crash)
-    if reset:
-        server.xend.domain.reset(dom)
+    server.xend.domain.dump(dom, filename, live, crash, reset)
 
 def xm_rename(args):
     arg_check(args, "rename", 2)