Nir Soffer has posted comments on this change.

Change subject: tests: fix make_block_volume size units
......................................................................


Patch Set 1:

(2 comments)

https://gerrit.ovirt.org/#/c/60408/1/tests/storagetestlib.py
File tests/storagetestlib.py:

Line 199:     imagedir = image_manifest.getImageDir(sduuid, imguuid)
Line 200:     os.makedirs(imagedir)
Line 201:     size_rounded = utils.round(size, MB)
Line 202:     size_mb = size_rounded / MB
Line 203:     size_blk = size_rounded / sc.BLOCK_SIZE
This add size_rounded, so we have to deal with 3 sizes in this function:

- size
- size_rounded
- size_mb
- size_blk

How about:

    size = utils.round(size, MB)
    size_mb = size / MB
    size_blk = size / sc.BLOCK_SIZE
Line 204:     lvm.createLV(sduuid, voluuid, size_mb)
Line 205:     with sd_manifest.acquireVolumeMetadataSlot(
Line 206:             voluuid, sc.VOLUME_MDNUMBLKS) as slot:
Line 207:         lvm.addtag(sduuid, voluuid, "%s%s" % (sc.TAG_PREFIX_MD, slot))


https://gerrit.ovirt.org/#/c/60408/1/tests/storagetestlibTests.py
File tests/storagetestlibTests.py:

Line 130:             img_id = str(uuid.uuid4())
Line 131:             vol_id = str(uuid.uuid4())
Line 132:             size_mb = 1
Line 133:             size_bytes = size_mb * MB
Line 134:             size_blk = size_bytes / sc.BLOCK_SIZE
Lets simplify by not adding another variable:

    size_mb = 1
    size_blk = size_mb * MB / sc.BLOCK_SIZE
Line 135:             make_block_volume(env.lvm, env.sd_manifest, size_mb,
Line 136:                               img_id, vol_id)
Line 137: 
Line 138:             self.assertEqual(vol_id, env.lvm.getLV(sd_id, 
vol_id).name)


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Idd582110ffe7c8e6c6dfb94cc90d63770d59e170
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <ali...@redhat.com>
Gerrit-Reviewer: Adam Litke <ali...@redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsof...@redhat.com>
Gerrit-Reviewer: gerrit-hooks <automat...@ovirt.org>
Gerrit-HasComments: Yes
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org

Reply via email to