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