[Kimchi-devel] [PATCH] Fix disk format lock during VM creation

Rodrigo Trujillo rodrigo.trujillo at linux.vnet.ibm.com
Thu Apr 16 14:37:45 UTC 2015


Thanks Cristian, I always forget to do this test, my bad.

On 04/15/2015 04:27 PM, Crístian Viana wrote:
> "make check-local" fails with this patch.
>
> On Tue, Apr 14, 2015 at 1:33 AM Rodrigo Trujillo <
> rodrigo.trujillo at 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 at 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 at ovirt.org
>> http://lists.ovirt.org/mailman/listinfo/kimchi-devel
>>
>
>
> _______________________________________________
> Kimchi-devel mailing list
> Kimchi-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/kimchi-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/kimchi-devel/attachments/20150416/a84b8921/attachment.html>


More information about the Kimchi-devel mailing list