[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH][RESEND] Fix stale-state issue with 'xm dom{id, name}'


  • To: Xen Developers <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: Dan Smith <danms@xxxxxxxxxx>
  • Date: Fri, 30 Sep 2005 09:54:55 -0700
  • Delivery-date: Fri, 30 Sep 2005 16:52:53 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

This is a resend of my stale state fix, which is yet unapplied.  If
there are issues, please let me know.

Note that this fixes the issue poked by xm-test, as shown in the
following snippet of David's latest FC3pae.report:

> FAIL: 01_shutdown_basic_pos 
>        I had to run an xm list to update xend state!

Signed-off-by: Dan Smith <danms@xxxxxxxxxx>
diff -r 9d047fb99e38 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Fri Sep 30 16:37:52 2005
+++ b/tools/python/xen/xend/XendDomainInfo.py   Fri Sep 30 09:47:51 2005
@@ -795,7 +795,7 @@
         if not info:
             info = dom_get(self.domid)
             if not info:
-                return
+                return False
             
         self.info.update(info)
         self.validateInfo()
@@ -803,6 +803,8 @@
 
         log.debug("XendDomainInfo.update done on domain %d: %s", self.domid,
                   self.info)
+
+        return True
 
 
     ## private:
diff -r 9d047fb99e38 tools/python/xen/xend/server/SrvDomain.py
--- a/tools/python/xen/xend/server/SrvDomain.py Fri Sep 30 16:37:52 2005
+++ b/tools/python/xen/xend/server/SrvDomain.py Fri Sep 30 09:47:51 2005
@@ -21,6 +21,8 @@
 from xen.xend import XendDomain
 from xen.xend import PrettyPrint
 from xen.xend.Args import FormFn
+from xen.xend.XendError import XendError
+from xen.xend.XendLogging import log
 
 from xen.web.SrvDir import SrvDir
 
@@ -210,7 +212,9 @@
         #
         # if op and op[0] in ['vifs', 'vif', 'vbds', 'vbd', 'mem_target_set']:
         #    return self.perform(req)
-        self.dom.update()
+        if not self.dom.update():
+            raise XendError("Domain %s no longer exists" % self.dom.getName())
+
         if self.use_sxp(req):
             req.setHeader("Content-Type", sxp.mime_type)
             sxp.show(self.dom.sxpr(), out=req)
diff -r 9d047fb99e38 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Fri Sep 30 16:37:52 2005
+++ b/tools/python/xen/xm/main.py       Fri Sep 30 09:47:51 2005
@@ -32,6 +32,7 @@
 warnings.filterwarnings('ignore', category=FutureWarning)
 from xen.xend import PrettyPrint
 from xen.xend import sxp
+from xen.xend.XendClient import XendError
 from xen.xm.opts import *
 shorthelp = """Usage: xm <subcommand> [args]
     Control, list, and manipulate Xen guest instances
@@ -385,14 +386,24 @@
     name = args[0]
 
     from xen.xend.XendClient import server
-    dom = server.xend_domain(name)
+    try:
+        dom = server.xend_domain(name)
+    except XendError, e:
+        err("Unable to get info for domain %s" % name)
+        sys.exit(1)
+        
     print sxp.child_value(dom, 'domid')
     
 def xm_domname(args):
     name = args[0]
 
     from xen.xend.XendClient import server
-    dom = server.xend_domain(name)
+    try:
+        dom = server.xend_domain(name)
+    except XendError, e:
+        err("Unable to get info for domain %s" % name)
+        sys.exit(1)
+        
     print sxp.child_value(dom, 'name')
 
 def xm_sched_bvt(args):
@@ -687,7 +698,6 @@
     args = argv[2:]
     if cmd:
         try:
-            from xen.xend.XendClient import XendError
             rc = cmd(args)
             if rc:
                 usage()
-- 
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms@xxxxxxxxxx
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.