Skip to contentSkip to conversation

Host.get_resident_VMs RPC

PATCH In review Jim Fehlig 2 participants 2 messages Dec 11, 2006 – Dec 13, 2006

lore
Share & tools
lore

Jim Fehlig

author
#0 lore raw

PATCH 1/1 Host.get_resident_VMs RPC

I've noticed that Host.get_resident_VMs RPC returns duplicate references to running VMs. Is this the intent or a bug :-)? In XendDomain.py we have

def get_domain_refs(self):

       result = []
       try:
           self.domains_lock.acquire()
           result = [d.get_uuid() for d in self.domains.values()]
           result += self.managed_domains.keys()
           return result
       finally:
           self.domains_lock.release()

and as you can see a running domain would be included twice in the resulting list. If this is a bug, patch attached. If intentional, please let me know so I can handle it appropriately in client code.

Regards,
Jim

# HG changeset patch
# User [email protected]
# Date 1165867640 25200
# Node ID 687e576ee99eb68d10324d0013bfd9acc372468c
# Parent 37141c3a3d39956ad5faf2d4e2a91276eaca557b
When enumerating VMs resident on a host (Host.get_resident_VMs RPC), ensure VMs with same UUID only appear once in the list.

tools/python/xen/xend/XendDomain.py +3 -1
diff -r 37141c3a3d39 -r 687e576ee99e tools/python/xen/xend/XendDomain.py
@@ -591,7 +591,9 @@ class XendDomain:
         try:
             self.domains_lock.acquire()
             result = [d.get_uuid() for d in self.domains.values()]
-            result += self.managed_domains.keys()
+            for d in self.managed_domains.keys():
+                if d not in result:
+                    result.append(d)
             return result
         finally:
             self.domains_lock.release()

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 20 lines · Jim Fehlig

I've noticed that Host.get_resident_VMs RPC returns duplicate references to running VMs. Is this the intent or a bug :-)? In XendDomain.py we have

   def get_domain_refs(self):
       result = []
       try:
           self.domains_lock.acquire()
           result = [d.get_uuid() for d in self.domains.values()]
           result += self.managed_domains.keys()
           return result
       finally:
           self.domains_lock.release()

and as you can see a running domain would be included twice in the resulting list. If this is a bug, patch attached. If intentional, please let me know so I can handle it appropriately in client code.

Regards,
Jim

Quoted 8 lines

# HG changeset patch
# User [email protected]
# Date 1165867640 25200
# Node ID 687e576ee99eb68d10324d0013bfd9acc372468c
# Parent 37141c3a3d39956ad5faf2d4e2a91276eaca557b
When enumerating VMs resident on a host (Host.get_resident_VMs RPC), ensure VMs with same UUID only appear once in the list.

That wasn't the intention, no! I've applied that, thanks Jim.

Ewan.