Sergey Gotliv has uploaded a new change for review.

Change subject: Fix calculation of file volume allocated size.
......................................................................

Fix calculation of file volume allocated size.

According to stat manual:

st_blocks is the number of 512B blocks allocated.

Therefore in order to calculate allocated size of the file volume
it's value should be multiply by 512 instead of stat.st_blksize.

On my environment a 4.5GB volume appeared in the Engine as 1176GB and
and I couldn't create additional disks on that storage domain because of
Engine validations.

Change-Id: I71646199e2c0ac4564b832b8ebb202f49e289344
Signed-off-by: Sergey Gotliv <[email protected]>
---
M vdsm/storage/fileSD.py
1 file changed, 5 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/90/21490/1

diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py
index f9ff93b..0093de7 100644
--- a/vdsm/storage/fileSD.py
+++ b/vdsm/storage/fileSD.py
@@ -298,7 +298,11 @@
         volPath = os.path.join(self.mountpoint, self.sdUUID, 'images',
                                imgUUID, volUUID)
         stat = self.oop.os.stat(volPath)
-        return stat.st_blocks * stat.st_blksize
+
+        # According to stat manual st_blocks is the number of 512B
+        # blocks allocated therefore it should be multiply by 512
+        # to get the allocated size
+        return stat.st_blocks * 512
 
     @classmethod
     def validateCreateVolumeParams(cls, volFormat, preallocate, srcVolUUID):


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I71646199e2c0ac4564b832b8ebb202f49e289344
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Sergey Gotliv <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to