Catch failures in getPoolInformation

Fixes #90
This commit is contained in:
Joshua Boniface 2020-03-15 16:58:13 -04:00
parent 0a367898a0
commit 4a52ff56b9
1 changed files with 5 additions and 2 deletions

View File

@ -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])