<div dir="ltr">"make check-local" fails with this patch.<br></div><br><div class="gmail_quote">On Tue, Apr 14, 2015 at 1:33 AM Rodrigo Trujillo <<a href="mailto:rodrigo.trujillo@linux.vnet.ibm.com">rodrigo.trujillo@linux.vnet.ibm.com</a>> 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 'LOGICAL') 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 <<a href="mailto:rodrigo.trujillo@linux.vnet.ibm.com" target="_blank">rodrigo.trujillo@linux.vnet.ibm.com</a>><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 = 'raw' if self._get_storage_type() in ['logical'] else 'qcow2'<br>
ret = []<br>
for i, d in enumerate(<a href="http://self.info" target="_blank">self.info</a>['disks']):<br>
index = d.get('index', i)<br>
@@ -201,11 +200,16 @@ class VMTemplate(object):<br>
<br>
info = {'name': volume,<br>
'capacity': d['size'],<br>
- 'format': fmt,<br>
+ 'format': d.get('format', 'qcow2'),<br>
'path': '%s/%s' % (storage_path, volume)}<br>
<br>
+ # Validate disk format<br>
+ if self._get_storage_type() in ['logical'] and \<br>
+ info['format'] != 'raw':<br>
+ info['format'] = 'raw'<br>
+<br>
if 'logical' == self._get_storage_type() or \<br>
- fmt not in ['qcow2', 'raw']:<br>
+ info['format'] not in ['qcow2', 'raw']:<br>
info['allocation'] = info['capacity']<br>
else:<br>
info['allocation'] = 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>