From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jim Fehlig Subject: Re: An Introduction to the Xen-API Work Date: Wed, 08 Nov 2006 10:34:24 -0700 Message-ID: <45521520.40307@novell.com> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------010602030208070209050405" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Stefan Berger , Ewan Mellor Cc: Xen-devel List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------010602030208070209050405 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 --------------010602030208070209050405 Content-Type: text/x-patch; name="xend-domain-lookup.patch" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="xend-domain-lookup.patch" ZGlmZiAtciA4ZWI4YzAwODU2MDQgdG9vbHMvcHl0aG9uL3hlbi94ZW5kL1hlbmREb21haW4u cHkKLS0tIGEvdG9vbHMvcHl0aG9uL3hlbi94ZW5kL1hlbmREb21haW4ucHkJTW9uIE5vdiAw NiAxNjozNjo1MSAyMDA2ICswMDAwCisrKyBiL3Rvb2xzL3B5dGhvbi94ZW4veGVuZC9YZW5k RG9tYWluLnB5CVdlZCBOb3YgMDggMTA6MzI6MjYgMjAwNiAtMDcwMApAQCAtNDcyLDEwICs0 NzIsOSBAQCBjbGFzcyBYZW5kRG9tYWluOgogICAgICAgICBzZWxmLmRvbWFpbnNfbG9jay5h Y3F1aXJlKCkKICAgICAgICAgdHJ5OgogICAgICAgICAgICAgIyBsb29rdXAgYnkgbmFtZQot ICAgICAgICAgICAgbWF0Y2ggPSBbZG9tIGZvciBkb20gaW4gc2VsZi5kb21haW5zLnZhbHVl cygpIFwKLSAgICAgICAgICAgICAgICAgICAgIGlmIGRvbS5nZXROYW1lKCkgPT0gZG9taWRd Ci0gICAgICAgICAgICBpZiBtYXRjaDoKLSAgICAgICAgICAgICAgICByZXR1cm4gbWF0Y2hb MF0KKyAgICAgICAgICAgIGZvciBkb20gaW4gc2VsZi5kb21haW5zLnZhbHVlcygpICsgc2Vs Zi5tYW5hZ2VkX2RvbWFpbnMudmFsdWVzKCk6CisgICAgICAgICAgICAgICAgaWYgZG9tLmdl dE5hbWUoKSA9PSBkb21pZDoKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGRvbQogCiAg ICAgICAgICAgICAjIGxvb2t1cCBieSBpZAogICAgICAgICAgICAgdHJ5Ogo= --------------010602030208070209050405 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------010602030208070209050405--