Correct handling of disk size in provisioner

This commit is contained in:
Joshua Boniface 2020-01-08 21:26:53 -05:00
parent 6cd3d5c888
commit 4f4b4c65c6
1 changed files with 4 additions and 2 deletions

View File

@ -975,11 +975,13 @@ def create_vm(self, vm_name, vm_profile, define_vm=True, start_vm=True):
for volume in vm_data['volumes']: for volume in vm_data['volumes']:
if volume['source_volume'] is not None: if volume['source_volume'] is not None:
if not volume['pool'] in pools: if not volume['pool'] in pools:
pools[volume['pool']], status = pvc_ceph.getVolumeInformation(zk_conn, volume['pool'], volume['source_volume'])['disk_size_gb'] volume_data, status = pvc_ceph.getVolumeInformation(zk_conn, volume['pool'], volume['source_volume'])
pools[volume['pool']] = volume_data['disk_size_gb']
if not status: if not status:
raise ClusterError('The source volume {}/{} could not be found'.format(volume['pool'], volume['source_volume'])) raise ClusterError('The source volume {}/{} could not be found'.format(volume['pool'], volume['source_volume']))
else: else:
pools[volume['pool']], status += pvc_ceph.getVolumeInformation(zk_conn, volume['pool'], volume['source_volume'])['disk_size_gb'] volume_data, status = pvc_ceph.getVolumeInformation(zk_conn, volume['pool'], volume['source_volume'])
pools[volume['pool']] += volume_data['disk_size_gb']
if not status: if not status:
raise ClusterError('The source volume {}/{} could not be found'.format(volume['pool'], volume['source_volume'])) raise ClusterError('The source volume {}/{} could not be found'.format(volume['pool'], volume['source_volume']))
else: else: