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-unstable] xm: Reuse VDI if location is same

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xm: Reuse VDI if location is same
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 15 Oct 2009 01:40:20 -0700
Delivery-date: Thu, 15 Oct 2009 01:41:06 -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 1255591868 -3600
# Node ID 6f79f2d5e63b8f79991fe422bb4147b0ee0dcdd3
# Parent  e976deb67899f6b9b802a2d8f029ef0ae8d1a132
xm: Reuse VDI if location is same

In XenAPI mode, when we start a VM by using xm create command, VDIs
are always automatically created for VBDs.  Once we shut down the
VM, then start the VM again, then VDIs are newly created.  As a
result, a vdi.xml file continues to expand.

This patch reuses VDIs if location of the VDIs is same.

Signed-off-by: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
---
 tools/python/xen/xm/xenapi_create.py |   10 ++++++++++
 1 files changed, 10 insertions(+)

diff -r e976deb67899 -r 6f79f2d5e63b tools/python/xen/xm/xenapi_create.py
--- a/tools/python/xen/xm/xenapi_create.py      Thu Oct 15 08:30:31 2009 +0100
+++ b/tools/python/xen/xm/xenapi_create.py      Thu Oct 15 08:31:08 2009 +0100
@@ -215,6 +215,16 @@ class xenapi_create:
     def create_vdi(self, vdi):
         log(DEBUG, "create_vdi")
 
+        for ref, record in server.xenapi.VDI.get_all_records().items():
+            location = record["other_config"]["location"]
+            if vdi.attributes["src"].value != location:
+                continue
+
+            # Reuse the VDI because the location is same.
+            key = vdi.attributes["name"].value
+            return (key, ref)
+
+        # Create a new VDI.
         vdi_record = {
             "name_label":       get_name_label(vdi),
             "name_description": get_name_description(vdi),

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xm: Reuse VDI if location is same, Xen patchbot-unstable <=