<div dir="ltr">&quot;make check-local&quot; fails with this patch.<br></div><br><div class="gmail_quote">On Tue, Apr 14, 2015 at 1:33 AM Rodrigo Trujillo &lt;<a href="mailto:rodrigo.trujillo@linux.vnet.ibm.com">rodrigo.trujillo@linux.vnet.ibm.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Users are able to pass the disk format (qcow, raw, etc) in disk Template<br>
information. However, Kimchi is ignoring this information and always<br>
creating qcow2 disk images (if the storagepool is not &#39;LOGICAL&#39;) when it<br>
creates a VM based on a given Template.<br>
This patch fixes this problem, using the disk format from the template,<br>
if it does not exist, uses qcow2 as default.<br>
<br>
Signed-off-by: Rodrigo Trujillo &lt;<a href="mailto:rodrigo.trujillo@linux.vnet.ibm.com" target="_blank">rodrigo.trujillo@linux.vnet.ibm.com</a>&gt;<br>
---<br>
 src/kimchi/vmtemplate.py | 10 +++++++---<br>
 1 file changed, 7 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/src/kimchi/vmtemplate.py b/src/kimchi/vmtemplate.py<br>
index ec477dd..de750d4 100644<br>
--- a/src/kimchi/vmtemplate.py<br>
+++ b/src/kimchi/vmtemplate.py<br>
@@ -193,7 +193,6 @@ class VMTemplate(object):<br>
<br>
     def to_volume_list(self, vm_uuid):<br>
         storage_path = self._get_storage_path()<br>
-        fmt = &#39;raw&#39; if self._get_storage_type() in [&#39;logical&#39;] else &#39;qcow2&#39;<br>
         ret = []<br>
         for i, d in enumerate(<a href="http://self.info" target="_blank">self.info</a>[&#39;disks&#39;]):<br>
             index = d.get(&#39;index&#39;, i)<br>
@@ -201,11 +200,16 @@ class VMTemplate(object):<br>
<br>
             info = {&#39;name&#39;: volume,<br>
                     &#39;capacity&#39;: d[&#39;size&#39;],<br>
-                    &#39;format&#39;: fmt,<br>
+                    &#39;format&#39;: d.get(&#39;format&#39;, &#39;qcow2&#39;),<br>
                     &#39;path&#39;: &#39;%s/%s&#39; % (storage_path, volume)}<br>
<br>
+            # Validate disk format<br>
+            if self._get_storage_type() in [&#39;logical&#39;] and \<br>
+               info[&#39;format&#39;] != &#39;raw&#39;:<br>
+                 info[&#39;format&#39;] = &#39;raw&#39;<br>
+<br>
             if &#39;logical&#39; == self._get_storage_type() or \<br>
-               fmt not in [&#39;qcow2&#39;, &#39;raw&#39;]:<br>
+               info[&#39;format&#39;] not in [&#39;qcow2&#39;, &#39;raw&#39;]:<br>
                 info[&#39;allocation&#39;] = info[&#39;capacity&#39;]<br>
             else:<br>
                 info[&#39;allocation&#39;] = 0<br>
--<br>
2.1.0<br>
<br>
_______________________________________________<br>
Kimchi-devel mailing list<br>
<a href="mailto:Kimchi-devel@ovirt.org" target="_blank">Kimchi-devel@ovirt.org</a><br>
<a href="http://lists.ovirt.org/mailman/listinfo/kimchi-devel" target="_blank">http://lists.ovirt.org/mailman/listinfo/kimchi-devel</a><br>
</blockquote></div>