[PATCH v2] [Kimchi] Fix template creation from image file

- When using an existing image as base for creating templates we cannot rely on its pool because it's undefined. This commit sets the default pool for this case. Signed-off-by: Jose Ricardo Ziviani <joserz@linux.vnet.ibm.com> --- vmtemplate.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vmtemplate.py b/vmtemplate.py index 653ad02..3270749 100644 --- a/vmtemplate.py +++ b/vmtemplate.py @@ -96,7 +96,9 @@ class VMTemplate(object): for index, disk in enumerate(disks): disk_info = dict(default_disk) - pool_type = self._get_storage_type(disk['pool']['name']) + pool = disk.get('pool', default_disk['pool']) + pool_type = self._get_storage_type(pool['name']) + if pool_type in ['iscsi', 'scsi']: disk_info = {'index': 0, 'format': 'raw', 'volume': None} -- 1.9.1

Reviewed-By: Ramon Medeiros <ramonn@br.ibm.com> On 04/08/2016 05:11 PM, Jose Ricardo Ziviani wrote:
- When using an existing image as base for creating templates we cannot rely on its pool because it's undefined. This commit sets the default pool for this case.
Signed-off-by: Jose Ricardo Ziviani <joserz@linux.vnet.ibm.com> --- vmtemplate.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/vmtemplate.py b/vmtemplate.py index 653ad02..3270749 100644 --- a/vmtemplate.py +++ b/vmtemplate.py @@ -96,7 +96,9 @@ class VMTemplate(object): for index, disk in enumerate(disks): disk_info = dict(default_disk)
- pool_type = self._get_storage_type(disk['pool']['name']) + pool = disk.get('pool', default_disk['pool']) + pool_type = self._get_storage_type(pool['name']) + if pool_type in ['iscsi', 'scsi']: disk_info = {'index': 0, 'format': 'raw', 'volume': None}
-- Ramon Nunes Medeiros Kimchi Developer Linux Technology Center Brazil IBM Systems & Technology Group Phone : +55 19 2132 7878 ramonn@br.ibm.com
participants (3)
-
Aline Manera
-
Jose Ricardo Ziviani
-
Ramon Medeiros