Change in vdsm[master]: FileStorageDomainManifest: move getVSize

alitke at redhat.com alitke at redhat.com
Fri Aug 7 15:38:44 UTC 2015


Adam Litke has uploaded a new change for review.

Change subject: FileStorageDomainManifest: move getVSize
......................................................................

FileStorageDomainManifest: move getVSize

An earlier patch moved getVSize only for BlockStorageDomainManifest
objects.  In order to keep the Manifest interface consistent between
different types of storage we must also make this change for
FileStorageDomainManifest objects.

Change-Id: I0c391448b233fac8717d9c85c1dbc547f36eba6f
Signed-off-by: Adam Litke <alitke at redhat.com>
---
M tests/manifest_tests.py
M vdsm/storage/fileSD.py
2 files changed, 15 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/64/44564/1

diff --git a/tests/manifest_tests.py b/tests/manifest_tests.py
index f9f0016..786cf43 100644
--- a/tests/manifest_tests.py
+++ b/tests/manifest_tests.py
@@ -44,6 +44,12 @@
             imguuid, voluuid = make_file_volume(manifest.domaindir, VOLSIZE)
             self.assertEqual(VOLSIZE, manifest.getVSize(imguuid, voluuid))
 
+    def test_getvallocsize(self):
+        with namedTemporaryDir() as tmpdir:
+            manifest = make_filesd_manifest(tmpdir)
+            imguuid, voluuid = make_file_volume(manifest.domaindir, VOLSIZE)
+            self.assertEqual(0, manifest.getVAllocSize(imguuid, voluuid))
+
     def test_getisodomainimagesdir(self):
         with namedTemporaryDir() as tmpdir:
             manifest = make_filesd_manifest(tmpdir)
diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py
index 2feb6b5..4eb2931 100644
--- a/vdsm/storage/fileSD.py
+++ b/vdsm/storage/fileSD.py
@@ -175,6 +175,14 @@
                                imgUUID, volUUID)
         return self.oop.os.stat(volPath).st_size
 
+    def getVAllocSize(self, imgUUID, volUUID):
+        """ Returns file volume allocated size in bytes. """
+        volPath = os.path.join(self.mountpoint, self.sdUUID, 'images',
+                               imgUUID, volUUID)
+        stat = self.oop.os.stat(volPath)
+
+        return stat.st_blocks * ST_BYTES_PER_BLOCK
+
     def getLeasesFilePath(self):
         return os.path.join(self.getMDPath(), sd.LEASES)
 
@@ -328,12 +336,7 @@
         return fileVolume.FileVolume
 
     def getVAllocSize(self, imgUUID, volUUID):
-        """ Returns file volume allocated size in bytes. """
-        volPath = os.path.join(self.mountpoint, self.sdUUID, 'images',
-                               imgUUID, volUUID)
-        stat = self.oop.os.stat(volPath)
-
-        return stat.st_blocks * ST_BYTES_PER_BLOCK
+        return self._manifest.getVAllocSize(imgUUID, volUUID)
 
     def getVolumeLease(self, imgUUID, volUUID):
         """


-- 
To view, visit https://gerrit.ovirt.org/44564
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0c391448b233fac8717d9c85c1dbc547f36eba6f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke at redhat.com>


More information about the vdsm-patches mailing list