ia64/xen-unstable

changeset 12806:97acbb7e2146

Move the actual call routed by do_legacy_api_with_uuid out of the scope of
the domains_lock. The call itself is already locking as necessary, and it
is important for domain_start to be able to release the lock across the scope
of waitForDevices.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Wed Dec 06 10:12:39 2006 +0000 (2006-12-06)
parents fb1291ffa26f
children 258722281202
files tools/python/xen/xend/XendDomain.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomain.py	Wed Dec 06 10:10:06 2006 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomain.py	Wed Dec 06 10:12:39 2006 +0000
     1.3 @@ -641,17 +641,22 @@ class XendDomain:
     1.4          return (self.get_vm_with_dev_uuid(klass, dev_uuid) != None)
     1.5  
     1.6      def do_legacy_api_with_uuid(self, fn, vm_uuid, *args, **kwargs):
     1.7 +        dom = self.uuid_to_dom(vm_uuid)
     1.8 +        fn(dom, *args, **kwargs)
     1.9 +
    1.10 +    def uuid_to_dom(self, vm_uuid):
    1.11          self.domains_lock.acquire()
    1.12          try:
    1.13              for domid, dom in self.domains.items():
    1.14 -                if dom.get_uuid == vm_uuid:
    1.15 -                    return fn(domid, *args, **kwargs)
    1.16 +                if dom.get_uuid() == vm_uuid:
    1.17 +                    return domid
    1.18                      
    1.19              if vm_uuid in self.managed_domains:
    1.20                  domid = self.managed_domains[vm_uuid].getDomid()
    1.21 -                if domid == None:
    1.22 -                    domid = self.managed_domains[vm_uuid].getName()
    1.23 -                return fn(domid, *args, **kwargs)
    1.24 +                if domid is None:
    1.25 +                    return self.managed_domains[vm_uuid].getName()
    1.26 +                else:
    1.27 +                    return domid
    1.28              
    1.29              raise XendInvalidDomain("Domain does not exist")
    1.30          finally: