aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshand@ubuntu.eng.hq.xensource.com <shand@ubuntu.eng.hq.xensource.com>2005-09-14 14:36:29 -0800
committershand@ubuntu.eng.hq.xensource.com <shand@ubuntu.eng.hq.xensource.com>2005-09-14 14:36:29 -0800
commitb22d5eebe3bd174446e78f6b64b8d3e7c7f64124 (patch)
treeeaa431aac69299268d6b66040ea35650e4447361
parent95b767d8e109d10621172621218a4e239ffd25eb (diff)
downloadxen-b22d5eebe3bd174446e78f6b64b8d3e7c7f64124.tar.gz
xen-b22d5eebe3bd174446e78f6b64b8d3e7c7f64124.tar.bz2
xen-b22d5eebe3bd174446e78f6b64b8d3e7c7f64124.zip
The dom destroy path is doing a dom_get on a non-existent domain to
ensure it is non-existent. This changes throws an explicit exception when xc_domain_getinfo returns an error, instead of triggering an internal python error. It then handles the exception in dom_get by returning None, which callers already expect to mean failure. Signed-off-by: Robert Read <robert@xensource.com>
-rw-r--r--tools/python/xen/lowlevel/xc/xc.c3
-rw-r--r--tools/python/xen/xend/XendDomainInfo.py10
2 files changed, 10 insertions, 3 deletions
diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index 7f398978eb..c7c09efbc1 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -220,6 +220,9 @@ static PyObject *pyxc_domain_getinfo(PyObject *self,
return PyErr_NoMemory();
nr_doms = xc_domain_getinfo(xc->xc_handle, first_dom, max_doms, info);
+
+ if (nr_doms < 0)
+ return PyErr_SetFromErrno(xc_error);
list = PyList_New(nr_doms);
for ( i = 0 ; i < nr_doms; i++ )
diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py
index 05edb93be2..b5929ce88b 100644
--- a/tools/python/xen/xend/XendDomainInfo.py
+++ b/tools/python/xen/xend/XendDomainInfo.py
@@ -110,9 +110,13 @@ def dom_get(dom):
@param dom: domain id
@return: info or None
"""
- domlist = xc.domain_getinfo(dom, 1)
- if domlist and dom == domlist[0]['dom']:
- return domlist[0]
+ try:
+ domlist = xc.domain_getinfo(dom, 1)
+ if domlist and dom == domlist[0]['dom']:
+ return domlist[0]
+ except Exception, err:
+ # ignore missing domain
+ log.exception("domain_getinfo(%d) failed, ignoring", dom)
return None
class XendDomainInfo: