WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-3.4-testing] xend: Unlink VDI instances and VBD ins

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-3.4-testing] xend: Unlink VDI instances and VBD instances
From: "Xen patchbot-3.4-testing" <patchbot-3.4-testing@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 01 Oct 2009 08:25:29 -0700
Delivery-date: Thu, 01 Oct 2009 08:27:32 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1254410080 -3600
# Node ID 502a69369482754ccb65bc130c3f5e0d32dffde9
# Parent  efcb14260292a686740cee8239aae0a503097eb8
xend: Unlink VDI instances and VBD instances

VBD information in xend does not have a VDI value if XenAPI mode
is invalid. A new patch confirms the VDI value is valid.  So, the new
patch cuts off VDI->VBD links if the VDI value is valid.

Signed-off-by: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
xen-unstable changeset:   20251:dc72e4fbab27
xen-unstable date:        Fri Sep 25 10:46:13 2009 +0100
---
 tools/python/xen/xend/XendDomain.py     |    2 ++
 tools/python/xen/xend/XendDomainInfo.py |   14 ++++++++++++++
 2 files changed, 16 insertions(+)

diff -r efcb14260292 -r 502a69369482 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       Thu Oct 01 16:14:10 2009 +0100
+++ b/tools/python/xen/xend/XendDomain.py       Thu Oct 01 16:14:40 2009 +0100
@@ -346,6 +346,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())
@@ -484,6 +485,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 efcb14260292 -r 502a69369482 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Thu Oct 01 16:14:10 2009 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py   Thu Oct 01 16:14:40 2009 +0100
@@ -3915,6 +3915,20 @@ 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_uuid = dev_info.get('VDI', None)
+            if vdi_uuid and XendNode.instance().is_valid_vdi(vdi_uuid):
+                vdi = XendNode.instance().get_vdi_by_uuid(vdi_uuid)
+                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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-3.4-testing] xend: Unlink VDI instances and VBD instances, Xen patchbot-3.4-testing <=