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

[Xen-changelog] Protect cleanupDomain with the refresh_shutdown_lock. This stops the device



# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID d77f0f6ebecea31e25c694ca049fd63c14af02f9
# Parent  045bee6e1ebd9c9c4cea8edf921cf33684066782
Protect cleanupDomain with the refresh_shutdown_lock.  This stops the device
and watch teardown being run concurrently from multiple threads, silencing
the No such file or directory error when tearing down the control/shutdown
watch, and reducing load on the store.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>

diff -r 045bee6e1ebd -r d77f0f6ebece tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Tue Mar 21 11:26:38 2006
+++ b/tools/python/xen/xend/XendDomainInfo.py   Tue Mar 21 11:41:33 2006
@@ -24,6 +24,7 @@
 
 """
 
+import errno
 import logging
 import string
 import time
@@ -893,7 +894,7 @@
                 self.domid, timeout)
             threading.Timer(timeout, self.refreshShutdown).start()
 
-        return 1
+        return True
 
 
     def shutdown(self, reason):
@@ -1246,30 +1247,34 @@
         """Cleanup domain resources; release devices.  Idempotent.  Nothrow
         guarantee."""
 
-        self.unwatchShutdown()
-
-        self.release_devices()
-
-        if self.image:
+        self.refresh_shutdown_lock.acquire()
+        try:
+            self.unwatchShutdown()
+
+            self.release_devices()
+
+            if self.image:
+                try:
+                    self.image.destroy()
+                except:
+                    log.exception(
+                        "XendDomainInfo.cleanup: image.destroy() failed.")
+                self.image = None
+
             try:
-                self.image.destroy()
+                self.removeDom()
             except:
-                log.exception(
-                    "XendDomainInfo.cleanup: image.destroy() failed.")
-            self.image = None
-
-        try:
-            self.removeDom()
-        except:
-            log.exception("Removing domain path failed.")
-
-        try:
-            if not self.info['name'].startswith(ZOMBIE_PREFIX):
-                self.info['name'] = ZOMBIE_PREFIX + self.info['name']
-        except:
-            log.exception("Renaming Zombie failed.")
-
-        self.state_set(STATE_DOM_SHUTDOWN)
+                log.exception("Removing domain path failed.")
+
+            try:
+                if not self.info['name'].startswith(ZOMBIE_PREFIX):
+                    self.info['name'] = ZOMBIE_PREFIX + self.info['name']
+            except:
+                log.exception("Renaming Zombie failed.")
+
+            self.state_set(STATE_DOM_SHUTDOWN)
+        finally:
+            self.refresh_shutdown_lock.release()
 
 
     def cleanupVm(self):
@@ -1301,7 +1306,8 @@
 
     def unwatchShutdown(self):
         """Remove the watch on the domain's control/shutdown node, if any.
-        Idempotent.  Nothrow guarantee."""
+        Idempotent.  Nothrow guarantee.  Expects to be protected by the
+        refresh_shutdown_lock."""
 
         try:
             try:

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