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] Cope with corrupt or empty VDI config fil

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Cope with corrupt or empty VDI config files. Have to_record return strings
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 25 Dec 2006 10:55:11 -0800
Delivery-date: Mon, 25 Dec 2006 10:55:52 -0800
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 1167063855 0
# Node ID eec06ba7afaa37208d79ef5763e0dd4a114518ec
# Parent  bd10d08598b07192e642e8ef8fe9fa76c5117689
Cope with corrupt or empty VDI config files.  Have to_record return strings
rather than integers, as required by the Xen-API spec.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendStorageRepository.py |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff -r bd10d08598b0 -r eec06ba7afaa 
tools/python/xen/xend/XendStorageRepository.py
--- a/tools/python/xen/xend/XendStorageRepository.py    Mon Dec 25 16:20:23 
2006 +0000
+++ b/tools/python/xen/xend/XendStorageRepository.py    Mon Dec 25 16:24:15 
2006 +0000
@@ -103,16 +103,16 @@ class XendStorageRepository:
         retval = {'uuid': self.uuid,
                   'name_label': self.name_label,
                   'name_description': self.name_description,
-                  'virtual_allocation': self.storage_alloc,
-                  'physical_utilisation': self.storage_used,
-                  'physical_size': self.storage_max,
+                  'virtual_allocation': str(self.storage_alloc),
+                  'physical_utilisation': str(self.storage_used),
+                  'physical_size': str(self.storage_max),
                   'type': self.type,
                   'location': self.location,
                   'VDIs': self.images.keys()}
         
         if self.storage_max == XEND_STORAGE_NO_MAXIMUM:
             stfs = os.statvfs(self.location)
-            retval['physical_size'] = stfs.f_blocks * stfs.f_frsize
+            retval['physical_size'] = str(stfs.f_blocks * stfs.f_frsize)
 
         return retval
         
@@ -148,7 +148,11 @@ class XendStorageRepository:
                                           virt_size, phys_size)
                         
                         if cfg_path and os.path.exists(cfg_path):
-                            vdi.load_config(cfg_path)
+                            try:
+                                vdi.load_config(cfg_path)
+                            except:
+                                log.error('Corrupt VDI configuration file %s' %
+                                          cfg_path)
                         
                         self.images[image_uuid] = 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] Cope with corrupt or empty VDI config files. Have to_record return strings, Xen patchbot-unstable <=