[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] The dom destroy path is doing a dom_get on a non-existent domain to



# HG changeset patch
# User shand@xxxxxxxxxxxxxxxxxxxxxxxxxxx
# Node ID fb72c78604c673bb07915675620bce3b7630e323
# Parent  122779b57b40600dcaf2d147ca82ec23da8e2c96
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@xxxxxxxxxxxxx>

diff -r 122779b57b40 -r fb72c78604c6 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Wed Sep 14 20:45:40 2005
+++ b/tools/python/xen/lowlevel/xc/xc.c Wed Sep 14 22:36:29 2005
@@ -220,6 +220,9 @@
         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 -r 122779b57b40 -r fb72c78604c6 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Wed Sep 14 20:45:40 2005
+++ b/tools/python/xen/xend/XendDomainInfo.py   Wed Sep 14 22:36:29 2005
@@ -110,9 +110,13 @@
     @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:

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.