Added eagerzeroedthick disk option to disk spec for vmware_guest (#28121)

* Added eagerzeroedthick disk option to disk spec
* Updated docstrings for vmware_guest disk
* VMware: Integration test for disk type

Signed-off-by: Steve Jacobs <sjacobs@brokencrew.com>
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Steve Jacobs 2017-11-20 20:11:28 -07:00 committed by Abhijeet Kasurde
commit 400d821fdb
2 changed files with 68 additions and 2 deletions

View file

@ -100,7 +100,8 @@ options:
- A list of disks to add.
- 'Valid attributes are:'
- ' - C(size_[tb,gb,mb,kb]) (integer): Disk storage size in specified unit.'
- ' - C(type) (string): Valid value is C(thin) (default: None).'
- ' - C(type) (string): Valid values are:'
- ' C(thin) thin disk, C(eagerzeroedthick) eagerzeroedthick disk, added in version 2.5, Default: C(None) thick disk, no eagerzero.'
- ' - C(datastore) (string): Datastore to use for the disk. If C(autoselect_datastore) is enabled, filter datastore selection.'
- ' - C(autoselect_datastore) (bool): select the less used datastore.'
cdrom:
@ -1018,8 +1019,11 @@ class PyVmomiHelper(PyVmomi):
# is it thin?
if 'type' in expected_disk_spec:
if expected_disk_spec.get('type', '').lower() == 'thin':
disk_type = expected_disk_spec.get('type', '').lower()
if disk_type == 'thin':
diskspec.device.backing.thinProvisioned = True
elif disk_type == 'eagerzeroedthick':
diskspec.device.backing.eagerlyScrub = True
# which datastore?
if expected_disk_spec.get('datastore'):