diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2009-04-17 13:04:47 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2009-04-17 13:04:47 +0100 |
commit | 9d09f146c9bce443acd32852ccb1722b0d2cbc4b (patch) | |
tree | 3ba6e0b0c373ba794575dfa7917a54d47b2e1a73 | |
parent | 3d506a34a70b9d56fc41d48524f3120fb0a9a65e (diff) | |
download | xen-9d09f146c9bce443acd32852ccb1722b0d2cbc4b.tar.gz xen-9d09f146c9bce443acd32852ccb1722b0d2cbc4b.tar.bz2 xen-9d09f146c9bce443acd32852ccb1722b0d2cbc4b.zip |
xend: clean up qemu-dm related items on domain 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@jp.fujitsu.com>
-rw-r--r-- | tools/python/xen/xend/image.py | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/tools/python/xen/xend/image.py b/tools/python/xen/xend/image.py index 1f2eb4a9f5..dc53e4a34c 100644 --- a/tools/python/xen/xend/image.py +++ b/tools/python/xen/xend/image.py @@ -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()) |