Change in vdsm[master]: Avoid redundant volume produces.

ewarszaw at redhat.com ewarszaw at redhat.com
Tue Aug 13 02:28:31 UTC 2013


Eduardo has uploaded a new change for review.

Change subject: Avoid redundant volume produces.
......................................................................

Avoid redundant volume produces.

Add sd.getVolumePath() returns the volume path without produce it.

Deprecating hsm.getVolumePath() and hsm.prepareVolume().
When removed, remove API.prepare(), BindingXMLRPC.volumePrepare(),
API.getPath, BindingXMLRPC.volumeGetPath(), etc.

Change-Id: I3ad53a7e8a66d7f9bdd62048f2bf1f722a490c5c
Signed-off-by: Eduardo <ewarszaw at redhat.com>
---
M vdsm/storage/fileSD.py
M vdsm/storage/hsm.py
M vdsm/storage/sd.py
3 files changed, 11 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/91/17991/1

diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py
index 9d1493d..8cbea23 100644
--- a/vdsm/storage/fileSD.py
+++ b/vdsm/storage/fileSD.py
@@ -302,8 +302,7 @@
         Return the volume lease (leasePath, leaseOffset)
         """
         if self.hasVolumeLeases():
-            vol = self.produceVolume(imgUUID, volUUID)
-            volumePath = vol.getVolumePath()
+            volumePath = self.getVolumePath(imgUUID, volUUID)
             leasePath = volumePath + fileVolume.LEASE_FILEEXT
             return leasePath, fileVolume.LEASE_FILEOFFSET
         return None, None
@@ -426,8 +425,9 @@
         # NFS volumes. In theory it is necessary to fix the permission
         # of the leaf only but to not introduce an additional requirement
         # (ordered volUUIDs) we fix them all.
-        for vol in [self.produceVolume(imgUUID, x) for x in volUUIDs]:
-            self.oop.fileUtils.copyUserModeToGroup(vol.getVolumePath())
+        for volUUID in volUUIDs:
+            volPath = self.getVolumePath(imgUUID, volUUID)
+            self.oop.fileUtils.copyUserModeToGroup(volPath)
 
     @classmethod
     def format(cls, sdUUID):
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index c754ee8..3545677 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -3076,6 +3076,7 @@
                                          volUUID=volUUID).getInfo()
         return dict(info=info)
 
+    @deprecated
     @public
     def getVolumePath(self, sdUUID, spUUID, imgUUID, volUUID, options=None):
         """
@@ -3100,8 +3101,7 @@
         """
         vars.task.getSharedLock(STORAGE, sdUUID)
         path = sdCache.produce(
-            sdUUID=sdUUID).produceVolume(imgUUID=imgUUID,
-                                         volUUID=volUUID).getVolumePath()
+            sdUUID=sdUUID).getVolumePath(imgUUID, volUUID)
         return dict(path=path)
 
     @public
@@ -3127,6 +3127,7 @@
         if fails:
             self.log.error("Failed to remove the following rules: %s", fails)
 
+    @deprecated
     @public
     def prepareVolume(self, sdUUID, spUUID, imgUUID, volUUID, rw=True,
                       options=None):
diff --git a/vdsm/storage/sd.py b/vdsm/storage/sd.py
index 36c4877..dde7832 100644
--- a/vdsm/storage/sd.py
+++ b/vdsm/storage/sd.py
@@ -640,6 +640,10 @@
         # If it has a repo we don't have multiple domains. Assume single pool
         return os.path.join(self.storage_repository, self.getPools()[0])
 
+    def getVolumePath(self, imgUUID, volUUID):
+        return os.path.join(self.mountpoint, self.sdUUID, 'images', imgUUID,
+                            volUUID)
+
     def getIsoDomainImagesDir(self):
         """
         Get 'images' directory from Iso domain


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3ad53a7e8a66d7f9bdd62048f2bf1f722a490c5c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw at redhat.com>


More information about the vdsm-patches mailing list