Nir Soffer has posted comments on this change.

Change subject: [WIP] core: Expose API for qemuimg commit
......................................................................


Patch Set 4:

(2 comments)

https://gerrit.ovirt.org/#/c/64222/4/tests/qemuimg_test.py
File tests/qemuimg_test.py:

Line 342:             size = 1048576
Line 343: 
Line 344:             qemuimg.create(base, size=size, format=qemuimg.FORMAT.RAW)
Line 345:             qemu_pattern_write(base, qemuimg.FORMAT.RAW, '0')
Line 346:             qemu_pattern_verify(base, qemuimg.FORMAT.RAW, '0', 0xf1)
This is broken because 0xf1 is not the pattern but the length.

Please use call kwargs using key=value - for example:

    qemu_pattern_write(base, qemuimg.FORMAT.RAW, offset='0', len='1k', 
pattern=0xf0)
Line 347: 
Line 348: 
Line 349:     @MonkeyPatch(qemuimg, 'config', CONFIG)
Line 350:     @permutations(((qemuimg.FORMAT.RAW,), (qemuimg.FORMAT.QCOW2,)))


Line 349:     @MonkeyPatch(qemuimg, 'config', CONFIG)
Line 350:     @permutations(((qemuimg.FORMAT.RAW,), (qemuimg.FORMAT.QCOW2,)))
Line 351:     def test_commit(self, baseFormat):
Line 352:         with namedTemporaryDir() as tmpdir:
Line 353:             base = os.path.join(tmpdir, 'base.img')
Lets move all the operations together for each volume:

    base = ...
    qemuimg.create(base, ...)
    qemu_pattern_write(base, ...)

Then we probably can move this into a little helper:

    def make_image(path, size, format, index, backing=None):
        qemuimg.create(path, size=size, format=format, backing=backing)
        qemu_pattern_write(path, format, offset="%dk" % index, len='1k', 0xf0 + 
index)

This will make the test much easier to get wrong, image always have data at the 
correct offset with the correct pattern.
Line 354:             top = os.path.join(tmpdir, 'top.img')
Line 355:             size = 1048576
Line 356: 
Line 357:             qemuimg.create(base, size=size, format=baseFormat)


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

Gerrit-MessageType: comment
Gerrit-Change-Id: If7a13be40541fb268541bd8614a642263b96b487
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ala Hino <ah...@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
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org

Reply via email to