Change in vdsm[master]: qemuimg: Create qcow2 compat 0.10 images when converting exi...
nsoffer at redhat.com
nsoffer at redhat.com
Wed Sep 24 17:54:43 UTC 2014
Nir Soffer has uploaded a new change for review.
Change subject: qemuimg: Create qcow2 compat 0.10 images when converting existing images
......................................................................
qemuimg: Create qcow2 compat 0.10 images when converting existing images
Commit 1f7c3ac2c handled only creation of new images. This patch adds the
required -o compat=0.10 option when converting existing images.
_supports_qcow2_compat() accepts a command argument and invokes the
specific command to detect if the compat option is supported.
Change-Id: I733fdd8c0e50a98627794c19c61b1d9bf6d6d6b1
Bug-Url: https://bugzilla.redhat.com/1139707
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
M lib/vdsm/qemuimg.py
1 file changed, 10 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/49/33349/1
diff --git a/lib/vdsm/qemuimg.py b/lib/vdsm/qemuimg.py
index c36bc26..e845ba3 100644
--- a/lib/vdsm/qemuimg.py
+++ b/lib/vdsm/qemuimg.py
@@ -115,7 +115,7 @@
if format:
cmd.extend(("-f", format))
- if format == FORMAT.QCOW2 and _supports_qcow2_compat():
+ if format == FORMAT.QCOW2 and _supports_qcow2_compat('create'):
cmd.extend(('-o', 'compat=' + QCOW2_COMPAT))
if backing:
@@ -137,12 +137,17 @@
raise QImgError(rc, out, err)
-def _supports_qcow2_compat():
+def _supports_qcow2_compat(command):
"""
TODO: Remove this when qemu versions providing the "compat" option are
available on all platforms.
"""
- cmd = [_qemuimg.cmd, "create", "-f", FORMAT.QCOW2, "-o", "?", "/dev/null"]
+ try:
+ flag = {"create": "-f", "convert": "-O", "ammend": "-f"}[command]
+ except KeyError:
+ return False
+
+ cmd = [_qemuimg.cmd, command, flag, FORMAT.QCOW2, "-o", "?", "/dev/null"]
rc, out, err = utils.execCmd(cmd, raw=True)
@@ -188,6 +193,8 @@
if dstFormat:
cmd.extend(("-O", dstFormat))
+ if dstFormat == FORMAT.QCOW2 and _supports_qcow2_compat('convert'):
+ cmd.extend(('-o', 'compat=' + QCOW2_COMPAT))
cmd.append(dstImage)
--
To view, visit http://gerrit.ovirt.org/33349
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I733fdd8c0e50a98627794c19c61b1d9bf6d6d6b1
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>
More information about the vdsm-patches
mailing list