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

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@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

This patch breaks the following tests in Intel (F21) and Power: ERROR: test_vm_storage_provisioning (test_model.ModelTests) ERROR: test_vm_customise_storage (test_rest.HttpsRestTests) ERROR: test_vm_customise_storage (test_rest.RestTests) ERROR: test_vm_lifecycle (test_rest.RestTests) FAIL: test_create_vm_with_img_based_template (test_rest.HttpsRestTests) FAIL: test_create_vm_with_img_based_template (test_rest.RestTests) Can you please take a look at these and re-send the patch? Thanks! On 06/04/2015 06:48 PM, Rodrigo Trujillo wrote:
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@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

Thanks, as this is a bug fix patch, I am going to send a new patch next week. Rodrigo On 06/05/2015 09:51 AM, Daniel Henrique Barboza wrote:
This patch breaks the following tests in Intel (F21) and Power:
ERROR: test_vm_storage_provisioning (test_model.ModelTests) ERROR: test_vm_customise_storage (test_rest.HttpsRestTests) ERROR: test_vm_customise_storage (test_rest.RestTests) ERROR: test_vm_lifecycle (test_rest.RestTests) FAIL: test_create_vm_with_img_based_template (test_rest.HttpsRestTests) FAIL: test_create_vm_with_img_based_template (test_rest.RestTests)
Can you please take a look at these and re-send the patch?
Thanks!
On 06/04/2015 06:48 PM, Rodrigo Trujillo wrote:
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@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
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel
participants (2)
-
Daniel Henrique Barboza
-
Rodrigo Trujillo