From: Dan Smith <danms@us.ibm.com>
To: Xen Developers <xen-devel@lists.xensource.com>
Cc: Xen Tools Developers <xen-tools@lists.xensource.com>
Subject: [PATCH] Clean up dom_get() usage
Date: Thu, 15 Sep 2005 10:15:28 -0700 [thread overview]
Message-ID: <87irx2xnf3.fsf@us.ibm.com> (raw)
[-- 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
next reply other threads:[~2005-09-15 17:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-15 17:15 Dan Smith [this message]
2005-09-16 19:22 ` [Xen-tools] [PATCH] Clean up dom_get() usage Christian Limpach
2005-09-16 20:57 ` Dan Smith
2005-09-16 22:03 ` Christian Limpach
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87irx2xnf3.fsf@us.ibm.com \
--to=danms@us.ibm.com \
--cc=xen-devel@lists.xensource.com \
--cc=xen-tools@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.