Change in vdsm[master]: tests: Fix FakeLVM lv creation size

alitke at redhat.com alitke at redhat.com
Fri Apr 8 21:02:49 UTC 2016


Adam Litke has uploaded a new change for review.

Change subject: tests: Fix FakeLVM lv creation size
......................................................................

tests: Fix FakeLVM lv creation size

This fixes two issues when creating fake LVs for testing.  First, the
value of MB is corrected.  Second, when creating block volumes the size
(specified in sectors) is rounded up to the nearest MB.

Change-Id: I975b35d4e386e23e3b58ede6314939f1ad293619
Signed-off-by: Adam Litke <alitke at redhat.com>
---
M tests/storagetestlib.py
1 file changed, 4 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/88/55888/1

diff --git a/tests/storagetestlib.py b/tests/storagetestlib.py
index f6a59ea..589d180 100644
--- a/tests/storagetestlib.py
+++ b/tests/storagetestlib.py
@@ -29,7 +29,7 @@
 
 NR_PVS = 2       # The number of fake PVs we use to make a fake VG by default
 MDSIZE = 524288  # The size (in bytes) of fake metadata files
-MB = 2 << 20     # Used to convert bytes to MB
+MB = 1048576     # Used to convert bytes to MB
 
 
 class FakeEnv(object):
@@ -157,7 +157,8 @@
     image_manifest = image.ImageManifest(sd_manifest.getRepoPath())
     imagedir = image_manifest.getImageDir(sduuid, imguuid)
     os.makedirs(imagedir)
-    lvm.createLV(sduuid, voluuid, size / MB)
+    size_mb = (size + MB - 1) / MB
+    lvm.createLV(sduuid, voluuid, size_mb)
     with sd_manifest.acquireVolumeMetadataSlot(
             voluuid, blockVolume.VOLUME_MDNUMBLKS) as slot:
         lvm.addtag(sduuid, voluuid, "%s%s" % (blockVolume.TAG_PREFIX_MD, slot))
@@ -172,7 +173,7 @@
         sduuid,
         imguuid,
         parent_vol_id,
-        size / volume.BLOCK_SIZE,
+        size_mb * MB / volume.BLOCK_SIZE,
         volume.type2name(vol_format),
         volume.type2name(prealloc),
         volume.type2name(volume.LEAF_VOL),


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I975b35d4e386e23e3b58ede6314939f1ad293619
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