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@xxxxxxxxxx>
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):
--
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms@xxxxxxxxxx
_______________________________________________
Xen-tools mailing list
Xen-tools@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-tools
|