1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Correctly cast the size_gb value for vpshere disks

Fixes #7385
This commit is contained in:
James Cammarata 2014-05-13 15:13:13 -05:00
parent 187619c7fe
commit 19dbff916f

View file

@ -725,14 +725,12 @@ def create_vm(vsphere_client, module, esxi, resource_pool, cluster_name, guest,
msg="Error on %s definition. datastore needs to be"
" specified." % disk)
try:
disksize = vm_disk[disk]['size_gb']
disksize = int(vm_disk[disk]['size_gb'])
# Convert the disk size to kiloboytes
disksize = disksize * 1024 * 1024
except KeyError:
except (KeyError, ValueError):
vsphere_client.disconnect()
module.fail_json(
msg="Error on %s definition. size needs to be"
" specified." % disk)
module.fail_json(msg="Error on %s definition. size needs to be specified as an integer." % disk)
try:
disktype = vm_disk[disk]['type']
except KeyError: