Change in vdsm[master]: qemu-img convert: check/use "-T src_cache" option when avail...

apahim at redhat.com apahim at redhat.com
Tue Dec 23 13:52:18 UTC 2014


Amador Pahim has posted comments on this change.

Change subject: qemu-img convert: check/use "-T src_cache" option when available
......................................................................


Patch Set 4:

(5 comments)

http://gerrit.ovirt.org/#/c/36308/4/lib/vdsm/qemuimg.py
File lib/vdsm/qemuimg.py:

Line 164:             backing=None, backingFormat=None):
Line 165:     cmd = [_qemuimg.cmd, "convert", "-t", "none"]
Line 166: 
Line 167:     if _supports_src_cache('convert'):
Line 168:         cmd.extend(("-T", "none"))
> The same is supported in "check" and in "rebase".
Ack.
Line 169: 
Line 170:     options = []
Line 171:     cwdPath = None
Line 172: 


Line 243: 
Line 244: # Testing capabilities
Line 245: 
Line 246: @utils.memoized
Line 247: def _supports_src_cache(command, out=None):
> This works, but is ugly. You don't add option which is meant only for testi
Done
Line 248:     """
Line 249:     qemu-img has a new "-T src_cache" option to avoid cache source
Line 250:     image. This will check if "-T" option is available.
Line 251:     """


Line 263:     pattern = r"\n +%s .*\[-T src_cache\]" % command
Line 264:     return re.search(pattern, out) is not None
Line 265: 
Line 266: 
Line 267: # Testing capabilities
> We don't need to repeat this - the idea is to have a comment for group of r
Done
Line 268: 
Line 269: def _supports_qcow2_compat(command):
Line 270:     """
Line 271:     qemu-img "create" and "convert" commands support a "compat" option in


http://gerrit.ovirt.org/#/c/36308/4/tests/qemu-img_--help.out
File tests/qemu-img_--help.out:

Line 1: qemu-img version 2.2.0, Copyright (c) 2004-2008 Fabrice Bellard
Line 2: usage: qemu-img command [command options]
Line 3: QEMU disk image utility
> +1
Done
Line 4: 
Line 5: Command syntax:
Line 6:   check [-q] [-f fmt] [--output=ofmt] [-r [leaks | all]] [-T src_cache] filename
Line 7:   create [-q] [-f fmt] [-o options] filename [size]


http://gerrit.ovirt.org/#/c/36308/4/tests/qemuimgTests.py
File tests/qemuimgTests.py:

Line 261:         path = os.path.join(dirName, "qemu-img_--help.out")
Line 262:         with open(path) as f:
Line 263:             out = f.read()
Line 264: 
Line 265:         self.assertTrue(qemuimg._supports_src_cache('convert', out))
> This test only the supported flow, we need to check both flows like the oth
Ok. I'm facing some issues with tests. Since we are mocking the utils.execCmd for _supports_qcow2_compat(), the new _supports_src_cache() inside qemuimg.convert is conflicting with _supports_qcow2_compat(). I will send a patch to fix this first.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I6e07f182e880f79055e53ef47aa28ddcf9659c45
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Amador Pahim <apahim at redhat.com>
Gerrit-Reviewer: Amador Pahim <apahim at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list