Eduardo has uploaded a new change for review. Change subject: Ignore partially deleted images in getAllImages(). ......................................................................
Ignore partially deleted images in getAllImages(). Change-Id: I028dabbf1a0b39177d0c52222cae177f5123442f Bug-url: https://bugzilla.redhat.com/show_bug.cgi?id=905038 Signed-off-by: Eduardo <[email protected]> --- M vdsm/storage/blockSD.py M vdsm/storage/fileSD.py M vdsm/storage/hsm.py M vdsm/storage/sd.py 4 files changed, 11 insertions(+), 29 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/38/12938/1 diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py index 4a00cec..c8be602 100644 --- a/vdsm/storage/blockSD.py +++ b/vdsm/storage/blockSD.py @@ -924,24 +924,12 @@ def getAllImages(self): """ - Get list of all images - - TODO: Remove and use getAllVolumes(). + Get the set of all images uuids in the SD. """ - try: - lvs = lvm.getLV(self.sdUUID) - except se.LogicalVolumeDoesNotExistError: - lvs = () # No LVs in this VG (domain) - - # Collect all the tags from all the volumes, but ignore duplicates - # set conveniently does exactly that - tags = set() - for lv in lvs: - tags.update(lv.tags) - # Drop non image tags and strip prefix - taglen = len(blockVolume.TAG_PREFIX_IMAGE) - images = [i[taglen:] for i in tags - if i.startswith(blockVolume.TAG_PREFIX_IMAGE)] + vols = self.getAllVolumes() # {volName: ([imgs], parent)} + images = set() + for imgs, parent in vols.itervalues(): + images.update(imgs) return images def rmDCVolLinks(self, imgPath, volsImgs): diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py index fa837fc..8a9627e 100644 --- a/vdsm/storage/fileSD.py +++ b/vdsm/storage/fileSD.py @@ -323,7 +323,7 @@ def getAllImages(self): """ - Fetch the list of the Image UUIDs + Fetch the set of the Image UUIDs in the SD. """ # Get Volumes of an image pattern = os.path.join(self.storage_repository, @@ -333,11 +333,11 @@ self.sdUUID, sd.DOMAIN_IMAGES) pattern = os.path.join(pattern, constants.UUID_GLOB_PATTERN) files = self.oop.glob.glob(pattern) - imgList = [] + images = set() for i in files: if self.oop.os.path.isdir(i): - imgList.append(os.path.basename(i)) - return imgList + images.update(os.path.basename(i)) + return images def deleteImage(self, sdUUID, imgUUID, volsImgs): currImgDir = getImagePath(sdUUID, imgUUID) diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py index 196862d..6b8da01 100644 --- a/vdsm/storage/hsm.py +++ b/vdsm/storage/hsm.py @@ -3138,7 +3138,7 @@ vars.task.getSharedLock(STORAGE, sdUUID) dom = sdCache.produce(sdUUID=sdUUID) if imgUUID == volume.BLANK_UUID: - images = dom.getAllImages() + images = list(dom.getAllImages()) else: images = [imgUUID] @@ -3164,7 +3164,7 @@ :rtype: dict """ vars.task.getSharedLock(STORAGE, sdUUID) - imageslist = sdCache.produce(sdUUID=sdUUID).getAllImages() + imageslist = list(sdCache.produce(sdUUID=sdUUID).getAllImages()) return dict(imageslist=imageslist) @public diff --git a/vdsm/storage/sd.py b/vdsm/storage/sd.py index cc06ce5..014e5bf 100644 --- a/vdsm/storage/sd.py +++ b/vdsm/storage/sd.py @@ -625,12 +625,6 @@ self.mountMaster() self.createMasterTree() - def getAllImages(self): - """ - Fetch the list of the Image UUIDs - """ - pass - def activateVolumes(self, volUUIDs): """ Activate all the volumes listed in volUUIDs -- To view, visit http://gerrit.ovirt.org/12938 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I028dabbf1a0b39177d0c52222cae177f5123442f Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Eduardo <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
