A user experienced an error while creating a VM using
logical storage. If a disk size greater than the available
capacity of a pool is requested, the pool.createXML fails,
but the user gets the generic kimchi "unexpected error" message.
This patch puts a try block around the createXML call, and
catches the libvirt error so it can be shown to the user.
Signed-off-by: Christy Perez <christy(a)linux.vnet.ibm.com>
---
src/kimchi/model/templates.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/kimchi/model/templates.py b/src/kimchi/model/templates.py
index 6e1a571..475f878 100644
--- a/src/kimchi/model/templates.py
+++ b/src/kimchi/model/templates.py
@@ -290,7 +290,10 @@ def fork_vm_storage(self, vm_uuid):
# TODO: Rebase on the storage API once upstream
pool = self._storage_validate()
vol_list = self.to_volume_list(vm_uuid)
- for v in vol_list:
- # outgoing text to libvirt, encode('utf-8')
- pool.createXML(v['xml'].encode('utf-8'), 0)
+ try:
+ for v in vol_list:
+ # outgoing text to libvirt, encode('utf-8')
+ pool.createXML(v['xml'].encode('utf-8'), 0)
+ except libvirt.libvirtError as e:
+ raise OperationFailed("KCHVMSTOR0008E", {'error':
e.message})
return vol_list
--
1.9.3
Show replies by date
Applied. Thanks.
Regards,
Aline Manera