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>
This commit is contained in:
shand@ubuntu.eng.hq.xensource.com committed 2005-09-14 14:36:29 -08:00
1 parent 95b767d8e1
commit b22d5eebe3
2 files changed
+10 -3

No files matched your search

+3
View File
@@ -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++ )
+7 -3
View File
@@ -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:
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.