Nir Soffer has uploaded a new change for review.
Change subject: qemuimg: Memoize _supports_qcow2_compat ......................................................................
qemuimg: Memoize _supports_qcow2_compat
We used to run qemu-img twice when creating or converting qcow2 images. The first run check if qemu-img supports the qcow2 "comapt" option, and the second run uses the result to format the qemu-img command.
Now we run qemu-img once for "create" and "convert" to learn about its capabilities, and use the cached value on the next runs. If qemu-img executable is modified, we drop the cache, in case a new version was installed with different capabilities.
Change-Id: Ic63f5e8c06993df8e4066bf7ac2dabfb4b4bdbfb Signed-off-by: Nir Soffer nsoffer@redhat.com --- M lib/vdsm/qemuimg.py M tests/qemuimgTests.py 2 files changed, 8 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/11/34711/1
diff --git a/lib/vdsm/qemuimg.py b/lib/vdsm/qemuimg.py index cf428b2..f295acc 100644 --- a/lib/vdsm/qemuimg.py +++ b/lib/vdsm/qemuimg.py @@ -23,6 +23,7 @@ import signal
from . import utils +from . import cache
_qemuimg = utils.CommandPath("qemu-img", "/usr/bin/qemu-img",) # Fedora, EL6 @@ -221,6 +222,7 @@ raise QImgError(rc, out, err)
+@cache.memoized(cache.file_validator(_qemuimg.cmd)) def _supports_qcow2_compat(command): """ qemu-img "create" and "convert" commands support a "compat" option in diff --git a/tests/qemuimgTests.py b/tests/qemuimgTests.py index 813a497..a642374 100644 --- a/tests/qemuimgTests.py +++ b/tests/qemuimgTests.py @@ -118,6 +118,9 @@
class CreateTests(TestCaseBase):
+ def setUp(self): + qemuimg._supports_qcow2_compat.invalidate() + def test_no_format(self): def create(cmd, **kw): expected = [QEMU_IMG, 'create', 'image'] @@ -161,6 +164,9 @@
class ConvertTests(TestCaseBase):
+ def setUp(self): + qemuimg._supports_qcow2_compat.invalidate() + def test_no_format(self): def convert(cmd, **kw): expected = [QEMU_IMG, 'convert', '-t', 'none', 'src', 'dst']
oVirt Jenkins CI Server has posted comments on this change.
Change subject: qemuimg: Memoize _supports_qcow2_compat ......................................................................
Patch Set 1:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/13316/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/13156/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/12366/ : FAILURE
Saggi Mizrahi has posted comments on this change.
Change subject: qemuimg: Memoize _supports_qcow2_compat ......................................................................
Patch Set 1: Code-Review+2
oVirt Jenkins CI Server has posted comments on this change.
Change subject: qemuimg: Memoize _supports_qcow2_compat ......................................................................
Patch Set 2:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/13326/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/13166/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/12376/ : FAILURE
Nir Soffer has posted comments on this change.
Change subject: qemuimg: Memoize _supports_qcow2_compat ......................................................................
Patch Set 2:
Version 2 clarify the code using the new memoize api.
Francesco Romani has posted comments on this change.
Change subject: qemuimg: Memoize _supports_qcow2_compat ......................................................................
Patch Set 2: Code-Review+1
oVirt Jenkins CI Server has posted comments on this change.
Change subject: qemuimg: Memoize _supports_qcow2_compat ......................................................................
Patch Set 3:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/13351/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/13192/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/12402/ : FAILURE
Nir Soffer has posted comments on this change.
Change subject: qemuimg: Memoize _supports_qcow2_compat ......................................................................
Patch Set 4:
Versions 3 and 4 are rebase, no code change.
oVirt Jenkins CI Server has posted comments on this change.
Change subject: qemuimg: Memoize _supports_qcow2_compat ......................................................................
Patch Set 4:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/13355/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/13196/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/12406/ : FAILURE
Jenkins CI RO has abandoned this change.
Change subject: qemuimg: Memoize _supports_qcow2_compat ......................................................................
Abandoned
Abandoned due to no activity - please restore if still relevant
Jenkins CI RO has posted comments on this change.
Change subject: qemuimg: Memoize _supports_qcow2_compat ......................................................................
Patch Set 4:
Abandoned due to no activity - please restore if still relevant
automation@ovirt.org has posted comments on this change.
Change subject: qemuimg: Memoize _supports_qcow2_compat ......................................................................
Patch Set 4:
* Update tracker::IGNORE, no Bug-Url found
Nir Soffer has restored this change.
Change subject: qemuimg: Memoize _supports_qcow2_compat ......................................................................
Restored
Unabandon
Jenkins CI RO has abandoned this change.
Change subject: qemuimg: Memoize _supports_qcow2_compat ......................................................................
Abandoned
Abandoned due to no activity - please restore if still relevant
gerrit-hooks has posted comments on this change.
Change subject: qemuimg: Memoize _supports_qcow2_compat ......................................................................
Patch Set 4:
* Update tracker: IGNORE, no Bug-Url found
vdsm-patches@lists.fedorahosted.org