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] Fixes to XendQCoWStorageRepo to match rec

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Fixes to XendQCoWStorageRepo to match recent API changes, and fix the refreshing
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 22 Mar 2007 14:10:12 -0700
Delivery-date: Thu, 22 Mar 2007 14:09:25 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/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 Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1174582922 0
# Node ID b98832bcac53f9295d60f65139cbc0dd97b64e90
# Parent  5f526fcc8e58dc41066e542b1f1a18e4a4307bb7
Fixes to XendQCoWStorageRepo to match recent API changes, and fix the refreshing
after a VDI is deleted.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendQCoWStorageRepo.py |   23 ++++-------------------
 1 files changed, 4 insertions(+), 19 deletions(-)

diff -r 5f526fcc8e58 -r b98832bcac53 
tools/python/xen/xend/XendQCoWStorageRepo.py
--- a/tools/python/xen/xend/XendQCoWStorageRepo.py      Thu Mar 22 16:32:18 
2007 +0000
+++ b/tools/python/xen/xend/XendQCoWStorageRepo.py      Thu Mar 22 17:02:02 
2007 +0000
@@ -208,7 +208,8 @@ class XendQCoWStorageRepo(XendStorageRep
         self.lock.acquire()
         try:
             if not self._has_space_available_for(desired_size_bytes):
-                raise XendError("Not enough space")
+                raise XendError("Not enough space (need %d)" %
+                                desired_size_bytes)
 
             image_uuid = uuid.createString()
             qcow_path = os.path.join(self.location,
@@ -251,6 +252,7 @@ class XendQCoWStorageRepo(XendStorageRep
                 except OSError:
                     log.exception("Failed to destroy image")
                 del self.images[image_uuid]
+                self._refresh()
                 return True
         finally:
             self.lock.release()
@@ -317,15 +319,12 @@ class XendQCoWStorageRepo(XendStorageRep
     def create_vdi(self, vdi_struct):
         image_uuid = None
         try:
-            sector_count = int(vdi_struct.get('virtual_size', 0))
-            sector_size = int(vdi_struct.get('sector_size', 1024))
-            size_bytes = (sector_count * sector_size)
+            size_bytes = int(vdi_struct.get('virtual_size', 0))
 
             image_uuid = self._create_image_files(size_bytes)
             
             image = self.images[image_uuid]
             image_cfg = {
-                'sector_size': sector_size,
                 'virtual_size': size_bytes,
                 'type': vdi_struct.get('type', 'system'),
                 'name_label': vdi_struct.get('name_label', ''),
@@ -350,17 +349,3 @@ class XendQCoWStorageRepo(XendStorageRep
             raise
 
         return image_uuid
-
-
-# remove everything below this line!! for testing only
-if __name__ == "__main__":
-    xsr = XendStorageRepository()
-    print 'Free Space: %d MB' % (xsr.free_space_bytes()/MB)
-    print "Create Image:",
-    print xsr._create_image_files(10 * MB)
-    print 'Delete all images:'
-    for image_uuid in xsr.list_images():
-        print image_uuid,
-        xsr._destroy_image_files(image_uuid)
-
-    print

_______________________________________________
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] Fixes to XendQCoWStorageRepo to match recent API changes, and fix the refreshing, Xen patchbot-unstable <=