WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: Stefan Berger <stefanb@xxxxxxxxxx>, Ewan Mellor <ewan@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] An Introduction to the Xen-API Work
From: Jim Fehlig <jfehlig@xxxxxxxxxx>
Date: Wed, 08 Nov 2006 10:34:24 -0700
Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 08 Nov 2006 09:36:22 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <OFC0D1AFE8.15C6DDE9-ON85257220.005274A8-85257220.00529831@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <OFC0D1AFE8.15C6DDE9-ON85257220.005274A8-85257220.00529831@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 1.5.0.7 (X11/20060909)
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