[NEW PATCH] BZ#736103 - Raise error when volumes acquision fails in image resource factory (via gerrit-bot)
Saggi Mizrahi
smizrahi at redhat.com
Thu Sep 8 09:15:02 UTC 2011
New patch submitted by Saggi Mizrahi (smizrahi at redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/915
commit 3cbaa27f9c883ee6343291126a5ad3027edd4de6
Author: Saggi Mizrahi <smizrahi at redhat.com>
Date: Thu Sep 8 12:15:57 2011 +0300
BZ#736103 - Raise error when volumes acquision fails in image resource factory
I chose not to reraise but to do `if failed:` because `raise e` would
have lost some of the exception information and I hate it when that
happens
Change-Id: I7f204831f0fd3875651f4718ec529cb8f0dcccaf
diff --git a/vdsm/storage/resourceFactories.py b/vdsm/storage/resourceFactories.py
index 152d00b..f71ecd9 100644
--- a/vdsm/storage/resourceFactories.py
+++ b/vdsm/storage/resourceFactories.py
@@ -145,7 +145,7 @@ class ImageResourceFactory(rm.SimpleResourceFactory):
if dom.__class__.__name__ == "BlockStorageDomain":
lvm.activateLVs(self.sdUUID, volUUIDChain)
- e = None
+ failed = False
# Acquire template locks:
# - 'lockType' for template's image itself
# - Always 'shared' lock for image based on template
@@ -167,13 +167,17 @@ class ImageResourceFactory(rm.SimpleResourceFactory):
volResourcesList.append(volRes)
except (rm.RequestTimedOutError, se.ResourceAcqusitionFailed), e:
log.debug("Cannot acquire volume resource (%s)", str(e))
+ failed = True
+ raise
except Exception, e:
log.debug("Cannot acquire volume resource", exc_info=True)
-
- if e:
- # Release already acquired template/volumes locks
- for volRes in volResourcesList:
- volRes.release()
+ failed = True
+ raise
+ finally:
+ if failed:
+ # Release already acquired template/volumes locks
+ for volRes in volResourcesList:
+ volRes.release()
return volResourcesList
More information about the vdsm-patches
mailing list