From 4a52ff56b9877030cb4779a94367f417674715e5 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Sun, 15 Mar 2020 16:58:13 -0400 Subject: [PATCH] Catch failures in getPoolInformation Fixes #90 --- api-daemon/pvcapid/provisioner.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/api-daemon/pvcapid/provisioner.py b/api-daemon/pvcapid/provisioner.py index 337dedbf..52ca2d33 100755 --- a/api-daemon/pvcapid/provisioner.py +++ b/api-daemon/pvcapid/provisioner.py @@ -1205,8 +1205,11 @@ def create_vm(self, vm_name, vm_profile, define_vm=True, start_vm=True): pools[volume['pool']] += volume['disk_size_gb'] for pool in pools: - pool_information = pvc_ceph.getPoolInformation(zk_conn, pool) - if not pool_information: + try: + pool_information = pvc_ceph.getPoolInformation(zk_conn, pool) + if not pool_information: + raise + except: raise ClusterError('Pool "{}" is not present on the cluster.'.format(pool)) pool_free_space_gb = int(pool_information['stats']['free_bytes'] / 1024 / 1024 / 1024) pool_vm_usage_gb = int(pools[pool])