Change in vdsm[ovirt-3.5]: storage: Search only the current image for children

alitke at redhat.com alitke at redhat.com
Mon Dec 1 20:37:30 UTC 2014


Hello Federico Simoncelli, Dan Kenigsberg,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/35769

to review the following change.

Change subject: storage: Search only the current image for children
......................................................................

storage: Search only the current image for children

The getChildren method of FileVolume is currently searching all images
in the storage domain for children.  A glob of all metadata files in the
SD is cached and then passed to grep to look for the child volumes.  The
problem is that deleteVolumes takes an exclusive lock on the image
namespace only.  If deletes are active on other images at the same time
we'll get errors with missing files.

The code attempts to report the children of a template base volume.
However, this is not needed now and is not expected to be required in
the future.  The getVolsOfImage API should be used for templates.
Therefore, we can fix this race by limiting the search for children to a
single image.

Change-Id: I2ef9012cee3a8cb891926510c10ecc47b7cddaa1
Signed-off-by: Adam Litke <alitke at redhat.com>
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1069610
Reviewed-on: http://gerrit.ovirt.org/35096
Reviewed-by: Dan Kenigsberg <danken at redhat.com>
Reviewed-by: Federico Simoncelli <fsimonce at redhat.com>
---
M vdsm/storage/fileVolume.py
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/69/35769/1

diff --git a/vdsm/storage/fileVolume.py b/vdsm/storage/fileVolume.py
index a8e9835..20573bd 100644
--- a/vdsm/storage/fileVolume.py
+++ b/vdsm/storage/fileVolume.py
@@ -361,10 +361,10 @@
     def getChildren(self):
         """ Return children volume UUIDs.
 
-        Children can be found in any image of the volume SD.
+        This API is not suitable for use with a template's base volume.
         """
         domPath = self.imagePath.split('images')[0]
-        metaPattern = os.path.join(domPath, 'images', '*', '*.meta')
+        metaPattern = os.path.join(domPath, 'images', self.imgUUID, '*.meta')
         metaPaths = oop.getProcessPool(self.sdUUID).glob.glob(metaPattern)
         pattern = "%s.*%s" % (volume.PUUID, self.volUUID)
         matches = grepCmd(pattern, metaPaths)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2ef9012cee3a8cb891926510c10ecc47b7cddaa1
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Adam Litke <alitke at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>


More information about the vdsm-patches mailing list