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

[Xen-devel] [PATCH] xend: certainly cleanup qemu-dm related stuffs on destroy



Some qemu-dm related stuffs might be left behind after the domain is destroyed.
 - xenstore entry, /local/domain/0/device-model/<domid>
 - named pipes, /var/run/tap/qemu-{read,write}-<domid>

Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>

diff -r 573e6673e9e0 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Wed Apr 15 15:47:25 2009 +0100
+++ b/tools/python/xen/xend/image.py    Fri Apr 17 09:31:32 2009 +0900
@@ -561,9 +561,9 @@ class ImageHandler:
     def destroyDeviceModel(self):
         if self.device_model is None:
             return
-        if self.pid:
-            self.sentinel_lock.acquire()
-            try:
+        self.sentinel_lock.acquire()
+        try:
+            if self.pid:
                 try:
                     os.kill(self.pid, signal.SIGHUP)
                 except OSError, exn:
@@ -592,22 +592,22 @@ class ImageHandler:
                     except OSError:
                         # This happens if the process doesn't exist.
                         pass
-                state = xstransact.Remove("/local/domain/0/device-model/%i"
-                                          % self.vm.getDomid())
-            finally:
-                self.pid = None
-                self.sentinel_lock.release()
+        finally:
+            self.pid = None
+            self.sentinel_lock.release()
             
-            try:
-                os.unlink('/var/run/tap/qemu-read-%d' % self.vm.getDomid())
-                os.unlink('/var/run/tap/qemu-write-%d' % self.vm.getDomid())
-            except:
-                pass
-            try:
-                del sentinel_fifos_inuse[self.sentinel_path_fifo]
-                os.unlink(self.sentinel_path_fifo)
-            except:
-                pass
+        state = xstransact.Remove("/local/domain/0/device-model/%i"
+                                  % self.vm.getDomid())
+        try:
+            os.unlink('/var/run/tap/qemu-read-%d' % self.vm.getDomid())
+            os.unlink('/var/run/tap/qemu-write-%d' % self.vm.getDomid())
+        except:
+            pass
+        try:
+            del sentinel_fifos_inuse[self.sentinel_path_fifo]
+            os.unlink(self.sentinel_path_fifo)
+        except:
+            pass
 
     def setCpuid(self):
         xc.domain_set_policy_cpuid(self.vm.getDomid())
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.