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

[Xen-changelog] [xen-unstable] [XEND] Fix domain_lookup_nr to check managed_domains too.



# HG changeset patch
# User Alastair Tse <atse@xxxxxxxxxxxxx>
# Node ID 023aa2926e7971eeb2fe208f987d2f2a20e824f0
# Parent  33ae8ae8693c7a1620798adadfdf99be02be367d
[XEND] Fix domain_lookup_nr to check managed_domains too.

Bug introduced when moving managed domains out of self.domains caused
domain_lookup_nr ignoring managed domains.

Signed-off-by: Alastair Tse <atse@xxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendDomain.py |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diff -r 33ae8ae8693c -r 023aa2926e79 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       Thu Nov 09 12:36:20 2006 +0000
+++ b/tools/python/xen/xend/XendDomain.py       Thu Nov 09 12:38:12 2006 +0000
@@ -57,10 +57,10 @@ class XendDomain:
 class XendDomain:
     """Index of all domains. Singleton.
 
-    @ivar domains: map of domains indexed by UUID Strings
+    @ivar domains: map of domains indexed by domid
     @type domains: dict of XendDomainInfo
-    @ivar managed_domains: uuid of domains that are managed by Xend
-    @type managed_domains: list of (uuids, dom_name)
+    @ivar managed_domains: domains that are not running and managed by Xend
+    @type managed_domains: dict of XendDomainInfo indexed by uuid
     @ivar domains_lock: lock that must be held when manipulating self.domains
     @type domains_lock: threaading.RLock
     @ivar _allow_new_domains: Flag to set that allows creating of new domains.
@@ -484,12 +484,27 @@ class XendDomain:
             if match:
                 return match[0]
 
+            match = [dom for dom in self.managed_domains.values() \
+                     if dom.getName() == domid]
+            if match:
+                return match[0]
+
             # lookup by id
             try:
                 if int(domid) in self.domains:
                     return self.domains[int(domid)]
             except ValueError:
                 pass
+
+            # lookup by uuid for running domains
+            match = [dom for dom in self.domains.values() \
+                     if dom.get_uuid() == domid]
+            if match:
+                return match[0]
+
+            # lookup by uuid for inactive managed domains 
+            if domid in self.managed_domains:
+                return self.managed_domains[domid]
 
             return None
         finally:

_______________________________________________
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®.