ia64/xen-unstable

changeset 8193:d581e11e247c

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>
author emellor@leeni.uk.xensource.com
date Fri Dec 02 15:36:39 2005 +0000 (2005-12-02)
parents f23db2051785
children a57cccdf2d6d
files tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Fri Dec 02 15:35:22 2005 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Fri Dec 02 15:36:39 2005 +0000
     1.3 @@ -775,7 +775,10 @@ class XendDomainInfo:
     1.4                      if reason == 'suspend':
     1.5                          self.state_set(STATE_DOM_SHUTDOWN)
     1.6                          # Don't destroy the domain.  XendCheckpoint will do
     1.7 -                        # this once it has finished.
     1.8 +                        # this once it has finished.  However, stop watching
     1.9 +                        # the VM path now, otherwise we will end up with one
    1.10 +                        # watch for the old domain, and one for the new.
    1.11 +                        self.unwatchVm()
    1.12                      elif reason in ['poweroff', 'reboot']:
    1.13                          restart_reason = reason
    1.14                      else:
    1.15 @@ -1185,18 +1188,31 @@ class XendDomainInfo:
    1.16      def cleanupVm(self):
    1.17          """Cleanup VM resources.  Idempotent.  Nothrow guarantee."""
    1.18  
    1.19 +        self.unwatchVm()
    1.20 +
    1.21 +        try:
    1.22 +            self.removeVm()
    1.23 +        except:
    1.24 +            log.exception("Removing VM path failed.")
    1.25 +
    1.26 +
    1.27 +    ## private:
    1.28 +
    1.29 +    def unwatchVm(self):
    1.30 +        """Remove the watch on the VM path, if any.  Idempotent.  Nothrow
    1.31 +        guarantee."""
    1.32 +
    1.33          try:
    1.34              try:
    1.35                  if self.vmWatch:
    1.36                      self.vmWatch.unwatch()
    1.37 +            finally:
    1.38                  self.vmWatch = None
    1.39 -            except:
    1.40 -                log.exception("Unwatching VM path failed.")
    1.41 +        except:
    1.42 +            log.exception("Unwatching VM path failed.")
    1.43  
    1.44 -            self.removeVm()
    1.45 -        except:
    1.46 -            log.exception("Removing VM path failed.")
    1.47  
    1.48 +    ## public:
    1.49  
    1.50      def destroy(self):
    1.51          """Cleanup VM and destroy domain.  Nothrow guarantee."""
    1.52 @@ -1351,6 +1367,7 @@ class XendDomainInfo:
    1.53              if rename:
    1.54                  self.preserveForRestart()
    1.55              else:
    1.56 +                self.unwatchVm()
    1.57                  self.destroyDomain()
    1.58  
    1.59              # new_dom's VM will be the same as this domain's VM, except where
    1.60 @@ -1387,6 +1404,7 @@ class XendDomainInfo:
    1.61          log.info("Renaming dead domain %s (%d, %s) to %s (%s).",
    1.62                   self.info['name'], self.domid, self.info['uuid'],
    1.63                   new_name, new_uuid)
    1.64 +        self.unwatchVm()
    1.65          self.release_devices()
    1.66          self.info['name'] = new_name
    1.67          self.info['uuid'] = new_uuid
    1.68 @@ -1398,6 +1416,7 @@ class XendDomainInfo:
    1.69      def preserve(self):
    1.70          log.info("Preserving dead domain %s (%d).", self.info['name'],
    1.71                   self.domid)
    1.72 +        self.unwatchVm()
    1.73          self.storeDom('xend/shutdown_completed', 'True')
    1.74          self.state_set(STATE_DOM_SHUTDOWN)
    1.75