All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Clean up dom_get() usage
@ 2005-09-15 17:15 Dan Smith
  2005-09-16 19:22 ` [Xen-tools] " Christian Limpach
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Smith @ 2005-09-15 17:15 UTC (permalink / raw)
  To: Xen Developers; +Cc: Xen Tools Developers

[-- Attachment #1: Type: text/plain, Size: 301 bytes --]

This patch adds sanity checks everywhere dom_get() is used.

In the case of XendDomainInfo.update(), if we get None back from
dom_get(), we destroy ourselves.  I believe that this should be the
desired behavior, but arguments to the contrary are welcome.

Signed-off-by: Dan Smith <danms@us.ibm.com>


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: xend-domget.patch --]
[-- Type: text/x-patch, Size: 1499 bytes --]

diff -r c27431cf81f9 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py	Thu Sep 15 13:17:24 2005
+++ b/tools/python/xen/xend/XendDomainInfo.py	Thu Sep 15 10:08:16 2005
@@ -117,6 +117,7 @@
     except Exception, err:
         # ignore missing domain
         log.exception("domain_getinfo(%d) failed, ignoring", dom)
+
     return None
 
 class XendDomainInfo:
@@ -356,9 +357,15 @@
         if info:
             self.info = info
         else:
-            di = dom_get(self.domid)
-            if not di:
-                return 
+            self.info = dom_get(self.domid)
+            # If we try to update and fail, we must have been
+            # deleted from the hypervisor
+            if not self.info:
+                log.debug("failed to get info for myself(%s); destroying..."%
+                          self.name)
+                self.destroy()
+                return
+            
         self.memory = self.info['mem_kb'] / 1024
         self.ssidref = self.info['ssidref']
 
@@ -1116,7 +1123,11 @@
                 else:
                     raise
             # get run-time value of vcpus and update store
-            self.configure_vcpus(dom_get(self.domid)['vcpus'])
+            dom0 = dom_get(self.domid)
+            if not dom0:
+                log.error("Failed to get info for dom0 while trying to configure VCPUs!")
+            else:
+                self.configure_vcpus(dom0['vcpus'])
 
 
 def vm_field_ignore(_, _1, _2, _3):

[-- Attachment #3: Type: text/plain, Size: 88 bytes --]


-- 
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms@us.ibm.com

[-- Attachment #4: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-09-16 22:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-15 17:15 [PATCH] Clean up dom_get() usage Dan Smith
2005-09-16 19:22 ` [Xen-tools] " Christian Limpach
2005-09-16 20:57   ` Dan Smith
2005-09-16 22:03     ` Christian Limpach

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.