Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vmware_guest_disk: Avoid using in maintenance DS (#1321)
vmware_guest_disk: Avoid using in maintenance DS The get_recommended_datastore from the vmware_guest_disk filters out datastores using the one with the greater amount of free space. However, it doesn't check the datastore status (eg. inMaintenance). When running the task on an SDRS cluster, which have a datastore in maintenance, and that datastore is the one with the greater amount of free space, the module fails with a pyvmomi error like: "This operation is not allowed in the current state of the datastore". This commit ensure to skip the selection of in-maintenance datastores by not even checking their size, and exclude them immediately. SUMMARY Avoid recommending in-maintenance datastores when trying to create a disk with vmware_guest_disk. (Not able to find issues reported for this error, but IIRC I've seen at least one in the previous days...) ISSUE TYPE Bugfix Pull Request COMPONENT NAME vmware_guest_disk ADDITIONAL INFORMATION The get_recommended_datastore from the vmware_guest_disk filters out datastores using the one with the greater amount of free space. However, it doesn't check the datastore status (eg. inMaintenance). When running the task on an SDRS cluster, which have a datastore in maintenance, and that datastore is the one with the greater amount of free space, the module fails with a pyvmomi error like: "This operation is not allowed in the current state of the datastore". This is because the recommended datastore is in-maintenance, and VMware refuses to operate on a datastore with this state. This commit ensure to skip the selection of in-maintenance datastores by not even checking their size, and exclude them immediately. Note that it may be required in other contexts such as : https://github.com/ansible-collections/community.vmware/blob/main/plugins/module_utils/vmware.py#L1669 Used by https://github.com/ansible-collections/community.vmware/blob/main/plugins/modules/vmware_recommended_datastore.py#L90 Reviewed-by: Mario Lenz <[email protected]>
- Loading branch information