Federico Simoncelli has uploaded a new change for review.
Change subject: fileVolume: make getVSize a real classmethod
......................................................................
fileVolume: make getVSize a real classmethod
Until now fileVolume even if declared as classmethod it was actually
relying on producing the object to obtain the required information. This
patch makes it a real classmethod, which is particularly useful to be
used also with an half-baked volume.
Bug-Url:
https://bugzilla.redhat.com/871811
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
Change-Id: I336d4e763da4ddc3c0dd8eacb68e84305995e6ab
---
M vdsm/storage/fileVolume.py
1 file changed, 5 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/95/8995/1
diff --git a/vdsm/storage/fileVolume.py b/vdsm/storage/fileVolume.py
index f19fa26..e2f4e85 100644
--- a/vdsm/storage/fileVolume.py
+++ b/vdsm/storage/fileVolume.py
@@ -460,7 +460,11 @@
@classmethod
def getVSize(cls, sdobj, imgUUID, volUUID, bs=512):
- return sdobj.produceVolume(imgUUID, volUUID).getVolumeSize(bs)
+ imagePath = image.Image(sdobj._getRepoPath()).getImageDir(
+ sdobj.sdUUID, imgUUID)
+ volPath = os.path.join(imagePath, volUUID)
+ stSize = oop.getProcessPool(sdobj.sdUUID).os.stat(volPath).st_size
+ return int(stSize / bs)
@classmethod
def getVTrueSize(cls, sdobj, imgUUID, volUUID, bs=512):
--
To view, visit
http://gerrit.ovirt.org/8995
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I336d4e763da4ddc3c0dd8eacb68e84305995e6ab
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>