"make check-local" fails with this patch.

On Tue, Apr 14, 2015 at 1:33 AM Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> wrote:
Users are able to pass the disk format (qcow, raw, etc) in disk Template
information. However, Kimchi is ignoring this information and always
creating qcow2 disk images (if the storagepool is not 'LOGICAL') when it
creates a VM based on a given Template.
This patch fixes this problem, using the disk format from the template,
if it does not exist, uses qcow2 as default.

Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com>
---
 src/kimchi/vmtemplate.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/kimchi/vmtemplate.py b/src/kimchi/vmtemplate.py
index ec477dd..de750d4 100644
--- a/src/kimchi/vmtemplate.py
+++ b/src/kimchi/vmtemplate.py
@@ -193,7 +193,6 @@ class VMTemplate(object):

     def to_volume_list(self, vm_uuid):
         storage_path = self._get_storage_path()
-        fmt = 'raw' if self._get_storage_type() in ['logical'] else 'qcow2'
         ret = []
         for i, d in enumerate(self.info['disks']):
             index = d.get('index', i)
@@ -201,11 +200,16 @@ class VMTemplate(object):

             info = {'name': volume,
                     'capacity': d['size'],
-                    'format': fmt,
+                    'format': d.get('format', 'qcow2'),
                     'path': '%s/%s' % (storage_path, volume)}

+            # Validate disk format
+            if self._get_storage_type() in ['logical'] and \
+               info['format'] != 'raw':
+                 info['format'] = 'raw'
+
             if 'logical' == self._get_storage_type() or \
-               fmt not in ['qcow2', 'raw']:
+               info['format'] not in ['qcow2', 'raw']:
                 info['allocation'] = info['capacity']
             else:
                 info['allocation'] = 0
--
2.1.0

_______________________________________________
Kimchi-devel mailing list
Kimchi-devel@ovirt.org
http://lists.ovirt.org/mailman/listinfo/kimchi-devel