Eduardo has uploaded a new change for review.

Change subject: Avoid Img and Vol produces in fileVolume.getV*Size
......................................................................

Avoid Img and Vol produces in fileVolume.getV*Size

No need for produce Images and Volumes for get the volume path
when calculating the size.

Related to BZ#960952, BZ#769502.

Change-Id: I9cccbba8a3dd1628c006fc47e7f13b6757fde9fe
Signed-off-by: Eduardo <ewars...@redhat.com>
---
M vdsm/storage/fileVolume.py
1 file changed, 5 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/10/17510/1

diff --git a/vdsm/storage/fileVolume.py b/vdsm/storage/fileVolume.py
index 0be8c44..cc61dde 100644
--- a/vdsm/storage/fileVolume.py
+++ b/vdsm/storage/fileVolume.py
@@ -406,14 +406,15 @@
 
     @classmethod
     def getVSize(cls, sdobj, imgUUID, volUUID, bs=BLOCK_SIZE):
-        imagePath = image.Image(sdobj._getRepoPath()).getImageDir(
-            sdobj.sdUUID, imgUUID)
-        volPath = os.path.join(imagePath, volUUID)
+        volPath = os.path.join(sdobj.mountpoint, sdobj.sdUUID, 'images',
+                               imgUUID, volUUID)
         return int(sdobj.oop.os.stat(volPath).st_size / bs)
 
     @classmethod
     def getVTrueSize(cls, sdobj, imgUUID, volUUID, bs=BLOCK_SIZE):
-        return sdobj.produceVolume(imgUUID, volUUID).getVolumeTrueSize(bs)
+        volPath = os.path.join(sdobj.mountpoint, sdobj.sdUUID, 'images',
+                               imgUUID, volUUID)
+        return int(int(sdobj.oop.os.stat(volPath).st_blocks) * BLOCK_SIZE / bs)
 
     @classmethod
     def renameVolumeRollback(cls, taskObj, oldPath, newPath):


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9cccbba8a3dd1628c006fc47e7f13b6757fde9fe
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewars...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to