Maor Lipchuk has uploaded a new change for review.

Change subject: [QCOW1.1]qemuimg: Add kwargs optional parameter for qcow.
......................................................................

[QCOW1.1]qemuimg: Add kwargs optional parameter for qcow.

Add kwargs of storage domain metadata to indicate the
appropriate qcow level to use for create and convert operations.

Change-Id: I8bbf8a60d0af1f99b3fae2c30ac06b36d5986180
Signed-off-by: Maor Lipchuk <mlipc...@redhat.com>
---
M lib/vdsm/qemuimg.py
1 file changed, 9 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/69/64169/1

diff --git a/lib/vdsm/qemuimg.py b/lib/vdsm/qemuimg.py
index 53a02c7..213890b 100644
--- a/lib/vdsm/qemuimg.py
+++ b/lib/vdsm/qemuimg.py
@@ -46,6 +46,7 @@
     VMDK = "vmdk"
 
 _QCOW2_COMPAT_SUPPORTED = ("0.10", "1.1")
+_QCOW2_1_1 = "1.1"
 
 
 def supports_compat(compat):
@@ -101,14 +102,14 @@
     return info
 
 
-def create(image, size=None, format=None, backing=None, backingFormat=None):
+def create(image, size=None, format=None, backing=None, backingFormat=None, 
kwargs=None):
     cmd = [_qemuimg.cmd, "create"]
     cwdPath = None
 
     if format:
         cmd.extend(("-f", format))
         if format == FORMAT.QCOW2:
-            cmd.extend(('-o', 'compat=' + _qcow2_compat()))
+            cmd.extend(('-o', 'compat=' + _qcow2_compat(kwargs)))
 
     if backing:
         if not os.path.isabs(backing):
@@ -153,7 +154,7 @@
 
 
 def convert(srcImage, dstImage, srcFormat=None, dstFormat=None,
-            backing=None, backingFormat=None):
+            backing=None, backingFormat=None, kwargs=None):
     cmd = [_qemuimg.cmd, "convert", "-p", "-t", "none", "-T", "none"]
     options = []
     cwdPath = None
@@ -166,7 +167,7 @@
     if dstFormat:
         cmd.extend(("-O", dstFormat))
         if dstFormat == FORMAT.QCOW2:
-            options.append('compat=' + _qcow2_compat())
+            options.append('compat=' + _qcow2_compat(kwargs))
 
     if backing:
         if not os.path.isabs(backing):
@@ -306,7 +307,10 @@
         raise QImgError(rc, out, err)
 
 
-def _qcow2_compat():
+def _qcow2_compat(kwargs):
+    sd_version = kwargs.get('version')
+    if sd_version == '4':
+        return _QCOW2_1_1
     value = config.get('irs', 'qcow2_compat')
     if value not in _QCOW2_COMPAT_SUPPORTED:
         raise exception.InvalidConfiguration(


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8bbf8a60d0af1f99b3fae2c30ac06b36d5986180
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Maor Lipchuk <mlipc...@redhat.com>
_______________________________________________
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