Change in vdsm[ovirt-3.5]: hsm: check volume existence in prepareImage

Federico Simoncelli fsimonce at redhat.com
Tue Sep 2 21:00:14 UTC 2014


Federico Simoncelli has uploaded a new change for review.

Change subject: hsm: check volume existence in prepareImage
......................................................................

hsm: check volume existence in prepareImage

This patch introduces a check in prepareImage to return a consistent
error (VolumeDoesNotExist) when the volume to prepare is not found.

Before this patch the error was:

 UnboundLocalError: local variable 'leafInfo' referenced
   before assignment

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1133617
Change-Id: Iceac3934b5eb3b7d3d68ea80ddd29cd9fe919c6c
Signed-off-by: Federico Simoncelli <fsimonce at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/31937
Reviewed-by: Allon Mureinik <amureini at redhat.com>
Reviewed-by: Nir Soffer <nsoffer at redhat.com>
Reviewed-by: Dan Kenigsberg <danken at redhat.com>
(cherry picked from commit 0e9c6a4fb2f126d10d445289753abbf03ed867ae)
---
M vdsm/storage/hsm.py
1 file changed, 4 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/37/32337/1

diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index d743759..413a604 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -3208,6 +3208,10 @@
         allVols = dom.getAllVolumes()
         # Filter volumes related to this image
         imgVolumes = sd.getVolsOfImage(allVols, imgUUID).keys()
+
+        if leafUUID not in imgVolumes:
+            raise se.VolumeDoesNotExist(leafUUID)
+
         imgPath = dom.activateVolumes(imgUUID, imgVolumes)
         if spUUID and spUUID != sd.BLANK_UUID:
             runImgPath = dom.linkBCImage(imgPath, imgUUID)


-- 
To view, visit http://gerrit.ovirt.org/32337
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iceac3934b5eb3b7d3d68ea80ddd29cd9fe919c6c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Federico Simoncelli <fsimonce at redhat.com>


More information about the vdsm-patches mailing list