Federico Simoncelli has uploaded a new change for review.
Change subject: blocksd: skip broken images in getAllVolumes
......................................................................
blocksd: skip broken images in getAllVolumes
When one of the images in the storage pool was damaged some operations
were failing for other images too (e.g. deletion).
This lead, for example, to the impossibility of removing VMs (and their
disks) on storage domains containing damaged images.
Change-Id: Ib9bbf7eecdb11873dd5fe9bef2afaa680aecbc32
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
---
M vdsm/storage/blockSD.py
1 file changed, 11 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/59/11859/1
diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py
index cc25417..404c3ef 100644
--- a/vdsm/storage/blockSD.py
+++ b/vdsm/storage/blockSD.py
@@ -164,18 +164,25 @@
"""
vols = _getVolsTree(sdUUID)
res = {}
+
for volName in vols.iterkeys():
res[volName] = {'imgs': [], 'parent': None}
for volName, vImg, parentVol in vols.itervalues():
res[volName]['parent'] = parentVol
+
if vImg not in res[volName]['imgs']:
res[volName]['imgs'].insert(0, vImg)
+
if (parentVol != sd.BLANK_UUID and
- not volName.startswith(
- sd.REMOVED_IMAGE_PREFIX) and
- vImg not in res[parentVol]['imgs']):
- res[parentVol]['imgs'].append(vImg)
+ not volName.startswith(sd.REMOVED_IMAGE_PREFIX)):
+ try:
+ if vImg not in res[parentVol]['imgs']:
+ res[parentVol]['imgs'].append(vImg)
+ except KeyError:
+ log.warning("Unable to find volume %s on domain %s, image "
+ "%s could be damaged, skipping", parentVol, vImg,
+ sdUUID, exc_info=True)
return dict((k, sd.ImgsPar(tuple(v['imgs']), v['parent']))
for k, v in res.iteritems())
--
To view, visit
http://gerrit.ovirt.org/11859
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib9bbf7eecdb11873dd5fe9bef2afaa680aecbc32
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>