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

[Xen-changelog] [xen-unstable] xend: Unlink VDI instances and VBD instances



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1253258858 -3600
# Node ID fc94d586d02fd9dca044d46ed4f72c1b3fa3fe7c
# Parent  d2b76e218c28d01ab2bf63aea8c3a5ce9804c802
xend: Unlink VDI instances and VBD instances

When VBD instances are destroyed by xm delete command, VDI
instances keep linking to the VBD instances unilaterally.

Signed-off-by: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendDomain.py     |    2 ++
 tools/python/xen/xend/XendDomainInfo.py |   12 ++++++++++++
 2 files changed, 14 insertions(+)

diff -r d2b76e218c28 -r fc94d586d02f tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       Fri Sep 18 08:26:53 2009 +0100
+++ b/tools/python/xen/xend/XendDomain.py       Fri Sep 18 08:27:38 2009 +0100
@@ -347,6 +347,7 @@ class XendDomain:
             if self.is_domain_managed(dom):
                 self._managed_config_remove(dom.get_uuid())
                 del self.managed_domains[dom.get_uuid()]
+                dom.unlink_xapi_instances()
                 dom.destroy_xapi_instances()
         except ValueError:
             log.warn("Domain is not registered: %s" % dom.get_uuid())
@@ -485,6 +486,7 @@ class XendDomain:
             if domid in self.domains:
                 del self.domains[domid]
 
+            info.unlink_xapi_instances()
             info.destroy_xapi_instances()
         else:
             log.warning("Attempted to remove non-existent domain.")
diff -r d2b76e218c28 -r fc94d586d02f tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Fri Sep 18 08:26:53 2009 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py   Fri Sep 18 08:27:38 2009 +0100
@@ -4043,6 +4043,18 @@ class XendDomainInfo:
             except Exception, exn:
                 raise XendError('Failed to destroy device')
 
+    def unlink_xapi_instances(self):
+        from xen.xend import XendDomain
+        if XendDomain.instance().is_valid_vm(self.info.get('uuid')):
+            # domain still exists.
+            return
+
+        for vbd_ref in self.info.get('vbd_refs'):
+            dev_info = self.info['devices'].get(vbd_ref)[1]
+            vdi = XendNode.instance().get_vdi_by_uuid(dev_info['VDI'])
+            if vdi.getVBDs().count(vbd_ref):
+                vdi.removeVBD(vbd_ref)
+
     def destroy_xapi_instances(self):
         """Destroy Xen-API instances stored in XendAPIStore.
         """

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