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

test fix for thin disk type issue

This commit is contained in:
Abdul-Anshad-A 2016-10-28 08:17:40 -04:00 committed by Brian Coca
parent 6d0f61b656
commit 36975c50ef

View file

@ -790,6 +790,7 @@ def update_disks(vsphere_client, vm, module, vm_disk, changes):
for cnf_disk in vm_disk:
disk_id = re.sub("disk", "", cnf_disk)
disk_type = vm_disk[cnf_disk]['type']
found = False
for dev_key in vm._devices:
if vm._devices[dev_key]['type'] == 'VirtualDisk':
@ -821,6 +822,9 @@ def update_disks(vsphere_client, vm, module, vm_disk, changes):
backing.DiskMode = "persistent"
backing.Split = False
backing.WriteThrough = False
if disk_type == 'thin':
backing.ThinProvisioned = True
else:
backing.ThinProvisioned = False
backing.EagerlyScrub = False
hd.Backing = backing
@ -863,6 +867,7 @@ def reconfigure_vm(vsphere_client, vm, module, esxi, resource_pool, cluster_name
changed, changes = update_disks(vsphere_client, vm,
module, vm_disk, changes)
vm.properties._flush_cache()
request = VI.ReconfigVM_TaskRequestMsg()
# Change extra config