[Kimchi-devel] ** IGNORE ** [PATCH] Template: Assign 'raw' to disk format if pool is 'logical' or [i]scsi

Rodrigo Trujillo rodrigo.trujillo at linux.vnet.ibm.com
Fri Apr 17 04:06:19 UTC 2015


Please, ignore this patch, it has pep8 and test errors.

On 04/17/2015 12:06 AM, Rodrigo Trujillo wrote:
> Kimchi always creates raw disk format to new vm disks if the storagepool
> is logical, iscsi or scsi. But, new templates where not using this
> logic and was possible, through API calls, to create a template with a
> SCSI storagepool and disk format vmdk, for instance.
> This patch fixes this issue.
>
> Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
> ---
>   src/kimchi/model/templates.py | 4 ++--
>   src/kimchi/vmtemplate.py      | 5 +++++
>   2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/src/kimchi/model/templates.py b/src/kimchi/model/templates.py
> index 6bc8aca..8a1820d 100644
> --- a/src/kimchi/model/templates.py
> +++ b/src/kimchi/model/templates.py
> @@ -94,7 +94,7 @@ class TemplatesModel(object):
>           # Creates the template class with necessary information
>           # Checkings will be done while creating this class, so any exception
>           # will be raised here
> -        t = LibvirtVMTemplate(params, scan=True)
> +        t = LibvirtVMTemplate(params, scan=True, conn=self.conn)
>           name = params['name']
>           try:
>               with self.objstore as session:
> @@ -231,8 +231,8 @@ class TemplateModel(object):
>
>   class LibvirtVMTemplate(VMTemplate):
>       def __init__(self, args, scan=False, conn=None):
> -        VMTemplate.__init__(self, args, scan)
>           self.conn = conn
> +        VMTemplate.__init__(self, args, scan)
>
>       def _storage_validate(self):
>           pool_uri = self.info['storagepool']
> diff --git a/src/kimchi/vmtemplate.py b/src/kimchi/vmtemplate.py
> index 62772e5..a309357 100644
> --- a/src/kimchi/vmtemplate.py
> +++ b/src/kimchi/vmtemplate.py
> @@ -75,6 +75,11 @@ class VMTemplate(object):
>               args['graphics'] = graphics
>           self.info.update(args)
>
> +        # Assign right disk format to logical and [i]scsi storagepools
> +        if self._get_storage_type() in ['logical', 'iscsi', 'scsi']:
> +            for i,disk in enumerate(self.info['disks']):
> +                self.info['disks'][i]['format'] = 'raw'
> +
>       def _get_os_info(self, args, scan):
>           distro = version = 'unknown'
>




More information about the Kimchi-devel mailing list