From 36975c50ef63b2b159686b0c8fbab27f9df98512 Mon Sep 17 00:00:00 2001 From: Abdul-Anshad-A Date: Fri, 28 Oct 2016 08:17:40 -0400 Subject: [PATCH] test fix for thin disk type issue --- lib/ansible/modules/cloud/vmware/vsphere_guest.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/vmware/vsphere_guest.py b/lib/ansible/modules/cloud/vmware/vsphere_guest.py index 27bf20d9b1..1ee92ea1ae 100644 --- a/lib/ansible/modules/cloud/vmware/vsphere_guest.py +++ b/lib/ansible/modules/cloud/vmware/vsphere_guest.py @@ -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,7 +822,10 @@ def update_disks(vsphere_client, vm, module, vm_disk, changes): backing.DiskMode = "persistent" backing.Split = False backing.WriteThrough = False - backing.ThinProvisioned = 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