Federico Simoncelli has uploaded a new change for review. Change subject: image: do not delete the template on deleteImage ......................................................................
image: do not delete the template on deleteImage Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=910013 Change-Id: I06c7e6402b901fab6277cd768ce82591e8c21e51 Signed-off-by: Federico Simoncelli <fsimo...@redhat.com> --- M vdsm/storage/hsm.py M vdsm/storage/image.py M vdsm/storage/sd.py 3 files changed, 5 insertions(+), 4 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/05/12105/1 diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py index ed6e262..793582b 100644 --- a/vdsm/storage/hsm.py +++ b/vdsm/storage/hsm.py @@ -1430,7 +1430,7 @@ vars.task.getExclusiveLock(STORAGE, imgUUID) vars.task.getSharedLock(STORAGE, sdUUID) allVols = dom.getAllVolumes() - volsByImg = sd.getVolsOfImage(allVols, imgUUID) + volsByImg = sd.getVolsOfImage(allVols, imgUUID, withTemplate=False) if not volsByImg: self.log.error("Empty or not found image %s in SD %s. %s", imgUUID, sdUUID, allVols) diff --git a/vdsm/storage/image.py b/vdsm/storage/image.py index 92021ff..9bb5da4 100644 --- a/vdsm/storage/image.py +++ b/vdsm/storage/image.py @@ -76,7 +76,7 @@ Replaces Image.delete() in Image.[copy(), move(),multimove()]. """ allVols = dom.getAllVolumes() - imgVols = sd.getVolsOfImage(allVols, imgUUID) + imgVols = sd.getVolsOfImage(allVols, imgUUID, withTemplate=False) if not imgVols: log.warning("No volumes found for image %s. %s", imgUUID, allVols) return diff --git a/vdsm/storage/sd.py b/vdsm/storage/sd.py index 9ce836b..17626e3 100644 --- a/vdsm/storage/sd.py +++ b/vdsm/storage/sd.py @@ -145,7 +145,7 @@ mountBasePath = os.path.join(storage_repository, DOMAIN_MNT_POINT) -def getVolsOfImage(allVols, imgUUID): +def getVolsOfImage(allVols, imgUUID, withTemplate=True): """ Filter allVols dict for volumes related to imgUUID. Returns {volName: (([templateImge], imgUUID, [otherImg]), volPar) @@ -155,7 +155,8 @@ """ return dict((volName, vol) for volName, vol in allVols.iteritems() - if imgUUID in vol.imgs) + if (vol.imgs[0] == imgUUID or + (withTemplate and imgUUID in vol.imgs))) def supportsUnicode(version): -- To view, visit http://gerrit.ovirt.org/12105 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I06c7e6402b901fab6277cd768ce82591e8c21e51 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Federico Simoncelli <fsimo...@redhat.com> _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches