New patch submitted by Eduardo Warszawski (ewarszaw(a)redhat.com)
You can review this change at:
http://gerrit.usersys.redhat.com/930
commit e945109a87795cef5c32150b574228c31fc6aea7
Author: Eduardo Warszawski <ewarszaw(a)redhat.com>
Date: Tue Sep 13 10:39:31 2011 +0300
BZ#736301 - Don't fail lvm.getVGbyUUID() if unredable VGs found.
Change-Id: Ief82082ebb3cfb6731dc9c7905f2844c60a7f425
diff --git a/vdsm/storage/lvm.py b/vdsm/storage/lvm.py
index 9bf8533..257616d 100644
--- a/vdsm/storage/lvm.py
+++ b/vdsm/storage/lvm.py
@@ -820,12 +820,18 @@ def getVG(vgName):
def getAllVGs():
return _lvminfo.getAllVgs() #returns list
-
+# TODO: lvm VG UUID should not be exposed.
+# Remove this function when hsm.public_createVG is removed.
def getVGbyUUID(vgUUID):
# cycle through all the VGs until the one with the given UUID found
for vg in getAllVGs():
- if vg.uuid == vgUUID:
- return vg
+ try:
+ if vg.uuid == vgUUID:
+ return vg
+ except AttributeError, e:
+ # An unreloadable VG found but may be we are not looking for it.
+ log.debug("%s" % e.message, exc_info=True)
+ continue
# If not cry loudly
raise se.VolumeGroupDoesNotExist("vg_uuid: %s" % vgUUID)