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

Re: [Xen-devel] An Introduction to the Xen-API Work



Stefan Berger wrote:

This here solves the problem.

diff -r 2408c042a276 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py Wed Nov 8 11:13:50 2006 +++ b/tools/python/xen/xend/XendDomain.py Wed Nov 8 09:58:35 2006
@@ -472,7 +472,7 @@
        self.domains_lock.acquire()
        try:
            # lookup by name
-            match = [dom for dom in self.domains.values() \
+            match = [dom for dom in self.managed_domains.values() \
                     if dom.getName() == domid]
            if match:
                return match[0]

 Stefan

Ah, this is essentially the xend patch I was referring to in http://lists.xensource.com/archives/html/xen-devel/2006-11/msg00361.html. In domain_lookup_nr, it appears only 'non-inactive' domains are in the domains dictionary, so this routine would not find the inactive domain that I was attempting to destroy. I took a slightly different approach (patch attached), but given my knowledge of the code was not sure of any potential side affects. Also I wasn't sure why we are building a list only to return the first item. Why not return the item when found? I realize that names are not unique but the current code doesn't handle duplicates anyway.

Ewan, can you comment on either of these patches? This routine needs to accommodate inactive domains as well.

Regards,
Jim

diff -r 8eb8c0085604 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       Mon Nov 06 16:36:51 2006 +0000
+++ b/tools/python/xen/xend/XendDomain.py       Wed Nov 08 10:32:26 2006 -0700
@@ -472,10 +472,9 @@ class XendDomain:
         self.domains_lock.acquire()
         try:
             # lookup by name
-            match = [dom for dom in self.domains.values() \
-                     if dom.getName() == domid]
-            if match:
-                return match[0]
+            for dom in self.domains.values() + self.managed_domains.values():
+                if dom.getName() == domid:
+                    return dom
 
             # lookup by id
             try:
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

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