- 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(a)linux.vnet.ibm.com>
---
vmtemplate.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/vmtemplate.py b/vmtemplate.py
index 653ad02..b71cf23 100644
--- a/vmtemplate.py
+++ b/vmtemplate.py
@@ -96,7 +96,12 @@ class VMTemplate(object):
for index, disk in enumerate(disks):
disk_info = dict(default_disk)
- pool_type = self._get_storage_type(disk['pool']['name'])
+ if 'pool' in disk and 'name' in disk['pool']:
+ pool_type = self._get_storage_type(disk['pool']['name'])
+ else:
+ pool_type = self._get_storage_type(
+ default_disk['pool']['name'])
+
if pool_type in ['iscsi', 'scsi']:
disk_info = {'index': 0, 'format': 'raw',
'volume': None}
--
1.9.1