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: for cnf_disk in vm_disk:
disk_id = re.sub("disk", "", cnf_disk) disk_id = re.sub("disk", "", cnf_disk)
disk_type = vm_disk[cnf_disk]['type']
found = False found = False
for dev_key in vm._devices: for dev_key in vm._devices:
if vm._devices[dev_key]['type'] == 'VirtualDisk': 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.DiskMode = "persistent"
backing.Split = False backing.Split = False
backing.WriteThrough = False backing.WriteThrough = False
if disk_type == 'thin':
backing.ThinProvisioned = True
else:
backing.ThinProvisioned = False backing.ThinProvisioned = False
backing.EagerlyScrub = False backing.EagerlyScrub = False
hd.Backing = backing 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, changed, changes = update_disks(vsphere_client, vm,
module, vm_disk, changes) module, vm_disk, changes)
vm.properties._flush_cache()
request = VI.ReconfigVM_TaskRequestMsg() request = VI.ReconfigVM_TaskRequestMsg()
# Change extra config # Change extra config