aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>2005-12-02 15:36:39 +0000
committeremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>2005-12-02 15:36:39 +0000
commit13b9e071a3877f2abf67f88a63c852a5c2c7b10b (patch)
tree2db21e8292330aa515aec9b4107f51731bdecb87
parent6d3895e2434e8c219c2fcc9a82795442f5ffec8a (diff)
downloadxen-13b9e071a3877f2abf67f88a63c852a5c2c7b10b.tar.gz
xen-13b9e071a3877f2abf67f88a63c852a5c2c7b10b.tar.bz2
xen-13b9e071a3877f2abf67f88a63c852a5c2c7b10b.zip
Remove the watch on the /vm/<uuid> path when rebooting or migrating. We don't
want to end up with multiple watches on the same path, otherwise we get a watch event storm after many such reboots or migrates. Signed-off-by: Ewan Mellor <ewan@xensource.com>
-rw-r--r--tools/python/xen/xend/XendDomainInfo.py31
1 files changed, 25 insertions, 6 deletions
diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py
index bb5f826526..0a2ebe52aa 100644
--- a/tools/python/xen/xend/XendDomainInfo.py
+++ b/tools/python/xen/xend/XendDomainInfo.py
@@ -775,7 +775,10 @@ class XendDomainInfo:
if reason == 'suspend':
self.state_set(STATE_DOM_SHUTDOWN)
# Don't destroy the domain. XendCheckpoint will do
- # this once it has finished.
+ # this once it has finished. However, stop watching
+ # the VM path now, otherwise we will end up with one
+ # watch for the old domain, and one for the new.
+ self.unwatchVm()
elif reason in ['poweroff', 'reboot']:
restart_reason = reason
else:
@@ -1185,19 +1188,32 @@ class XendDomainInfo:
def cleanupVm(self):
"""Cleanup VM resources. Idempotent. Nothrow guarantee."""
+ self.unwatchVm()
+
+ try:
+ self.removeVm()
+ except:
+ log.exception("Removing VM path failed.")
+
+
+ ## private:
+
+ def unwatchVm(self):
+ """Remove the watch on the VM path, if any. Idempotent. Nothrow
+ guarantee."""
+
try:
try:
if self.vmWatch:
self.vmWatch.unwatch()
+ finally:
self.vmWatch = None
- except:
- log.exception("Unwatching VM path failed.")
-
- self.removeVm()
except:
- log.exception("Removing VM path failed.")
+ log.exception("Unwatching VM path failed.")
+ ## public:
+
def destroy(self):
"""Cleanup VM and destroy domain. Nothrow guarantee."""
@@ -1351,6 +1367,7 @@ class XendDomainInfo:
if rename:
self.preserveForRestart()
else:
+ self.unwatchVm()
self.destroyDomain()
# new_dom's VM will be the same as this domain's VM, except where
@@ -1387,6 +1404,7 @@ class XendDomainInfo:
log.info("Renaming dead domain %s (%d, %s) to %s (%s).",
self.info['name'], self.domid, self.info['uuid'],
new_name, new_uuid)
+ self.unwatchVm()
self.release_devices()
self.info['name'] = new_name
self.info['uuid'] = new_uuid
@@ -1398,6 +1416,7 @@ class XendDomainInfo:
def preserve(self):
log.info("Preserving dead domain %s (%d).", self.info['name'],
self.domid)
+ self.unwatchVm()
self.storeDom('xend/shutdown_completed', 'True')
self.state_set(STATE_DOM_SHUTDOWN)