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

[Xen-changelog] [xen-unstable] xend: Refactor vmmetrics destruction.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1222078539 -3600
# Node ID a1e86caf83a318cc62a8675b59464da77921e685
# Parent  2e8ad0c35792d1961c17d37f073e85b863519a92
xend: Refactor vmmetrics destruction.

Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@xxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendDomain.py     |    5 ++---
 tools/python/xen/xend/XendDomainInfo.py |   17 ++++++++++-------
 2 files changed, 12 insertions(+), 10 deletions(-)

diff -r 2e8ad0c35792 -r a1e86caf83a3 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       Thu Sep 18 10:43:08 2008 +0100
+++ b/tools/python/xen/xend/XendDomain.py       Mon Sep 22 11:15:39 2008 +0100
@@ -344,6 +344,7 @@ class XendDomain:
             if self.is_domain_managed(dom):
                 self._managed_config_remove(dom.get_uuid())
                 del self.managed_domains[dom.get_uuid()]
+                dom.destroy_xapi_instances()
         except ValueError:
             log.warn("Domain is not registered: %s" % dom.get_uuid())
 
@@ -481,7 +482,7 @@ class XendDomain:
             if domid in self.domains:
                 del self.domains[domid]
 
-            info.destroy_xapi_device_instances()
+            info.destroy_xapi_instances()
         else:
             log.warning("Attempted to remove non-existent domain.")
 
@@ -1091,11 +1092,9 @@ class XendDomain:
         log.info("Domain %s (%s) deleted." %
                  (dominfo.getName(), dominfo.info.get('uuid')))
                 
-        dominfo.metrics.destroy()
         self._managed_domain_unregister(dominfo)
         self._remove_domain(dominfo)
         XendDevices.destroy_device_state(dominfo)
-        dominfo.destroy_xapi_device_instances()
 
 
     def domain_configure(self, config):
diff -r 2e8ad0c35792 -r a1e86caf83a3 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Thu Sep 18 10:43:08 2008 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py   Mon Sep 22 11:15:39 2008 +0100
@@ -2642,9 +2642,6 @@ class XendDomainInfo:
     def _cleanupVm(self):
         """Cleanup VM resources.  Idempotent.  Nothrow guarantee."""
 
-        from xen.xend import XendDomain
-        if not XendDomain.instance().is_domain_managed(self):
-            self.metrics.destroy()
         self._unwatchVm()
 
         try:
@@ -3507,12 +3504,12 @@ class XendDomainInfo:
             except Exception, exn:
                 raise XendError('Failed to destroy device')
 
-    def destroy_xapi_device_instances(self):
-        """Destroy Xen-API device instances stored in XendAPIStore.
+    def destroy_xapi_instances(self):
+        """Destroy Xen-API instances stored in XendAPIStore.
         """
         # Xen-API classes based on XendBase have their instances stored
-        # in XendAPIStore. Cleanup these virtual device instances here
-        # if they are supposed to be destroyed when the parent domain is dead.
+        # in XendAPIStore. Cleanup these instances here, if they are supposed
+        # to be destroyed when the parent domain is dead.
         #
         # Most of the virtual devices (vif, vbd, vfb, etc) are not based on
         # XendBase and there's no need to remove them from XendAPIStore.
@@ -3522,6 +3519,12 @@ class XendDomainInfo:
             # domain still exists.
             return
 
+        # Destroy the VMMetrics instance.
+        if XendAPIStore.get(self.metrics.get_uuid(), self.metrics.getClass()) \
+                is not None:
+            self.metrics.destroy()
+
+        # Destroy DPCI instances.
         for dpci_uuid in XendDPCI.get_by_VM(self.info.get('uuid')):
             XendAPIStore.deregister(dpci_uuid, "DPCI")
             

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