[Kimchi-devel] [PATCH] Fix issue: Kimchi always create qcow2 disk images

Rodrigo Trujillo rodrigo.trujillo at linux.vnet.ibm.com
Thu Jun 4 21:48:18 UTC 2015


If the user change disk format in template.conf, templates are going to
be created correctly and vm xml as well. But, when the disk is created,
the format is always qcow2.
Removing the line:
"fmt = 'raw' if self._get_storage_type() in ['logical'] else 'qcow2'"
fixes the issue, since same checking is being done in __init__ in line
78.

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

diff --git a/src/kimchi/vmtemplate.py b/src/kimchi/vmtemplate.py
index e047228..e73c487 100644
--- a/src/kimchi/vmtemplate.py
+++ b/src/kimchi/vmtemplate.py
@@ -192,7 +192,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)
@@ -200,11 +199,11 @@ class VMTemplate(object):
 
             info = {'name': volume,
                     'capacity': d['size'],
-                    'format': fmt,
+                    'format': d['format'],
                     'path': '%s/%s' % (storage_path, volume)}
 
             if 'logical' == self._get_storage_type() or \
-               fmt not in ['qcow2', 'raw']:
+               d['format'] not in ['qcow2', 'raw']:
                 info['allocation'] = info['capacity']
             else:
                 info['allocation'] = 0
-- 
2.1.0




More information about the Kimchi-devel mailing list