Change in vdsm[master]: tests: Add tests for Drive.getNextVolumeSize

nsoffer at redhat.com nsoffer at redhat.com
Wed Feb 11 17:23:39 UTC 2015


Nir Soffer has uploaded a new change for review.

Change subject: tests: Add tests for Drive.getNextVolumeSize
......................................................................

tests: Add tests for Drive.getNextVolumeSize

This function mixes sizes in different units, resulting in failure to
limit the volume size to Drive.truesize.

Change-Id: I2140af915f39c48803546ca7e44e07ae05872843
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
M tests/vmStorageTests.py
1 file changed, 24 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/25/37725/1

diff --git a/tests/vmStorageTests.py b/tests/vmStorageTests.py
index cb10b8b..925d52d 100644
--- a/tests/vmStorageTests.py
+++ b/tests/vmStorageTests.py
@@ -19,10 +19,12 @@
 #
 
 from monkeypatch import MonkeyPatch
+from testValidation import brokentest
 from testlib import VdsmTestCase
 from testlib import XMLTestCase
 from testlib import permutations, expandPermutations
 
+from vdsm import constants
 from vdsm import utils
 from virt.vmdevices.storage import Drive
 
@@ -242,6 +244,28 @@
         self.assertEqual(drive.chunked, chunked)
 
 
+class GetNextVolumeSizeTests(VdsmTestCase):
+
+    def test_first_extend(self):
+        drive = self.chunked_drive(1024, 8192)
+        apparentsize_mb = drive.apparentsize / constants.MEGAB
+        size_mb = apparentsize_mb + drive.volExtensionChunk
+        self.assertEqual(drive.getNextVolumeSize(drive.apparentsize), size_mb)
+
+    @brokentest()
+    def test_truesize_limit(self):
+        drive = self.chunked_drive(8191, 8192)
+        self.assertEqual(drive.getNextVolumeSize(drive.apparentsize), 8192)
+
+    def chunked_drive(self, size_mb, maxsize_mb):
+        conf = drive_config(
+            apparentsize=str(size_mb * constants.MEGAB),
+            format='cow',
+            truesize=str(maxsize_mb * constants.MEGAB),
+        )
+        return Drive({}, self.log, **conf)
+
+
 def drive_config(**kw):
     """ Reutrn drive configuration updated from **kw """
     conf = {


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2140af915f39c48803546ca7e44e07ae05872843
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>


More information about the vdsm-patches mailing list