-
Notifications
You must be signed in to change notification settings - Fork 339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vmware_guest_disk: Avoid using in maintenance DS #1321
vmware_guest_disk: Avoid using in maintenance DS #1321
Conversation
8cdee3c
to
4c3d6b0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR @Tireg!
Could you please add a changelog fragment like this? Something like:
bugfixes:
- vmware_guest_disk - Ignore datastores in maintenance mode (https://github.com/ansible-collections/community.vmware/pull/1321).
or similar.
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.
4c3d6b0
to
eea80df
Compare
This should be ok now. I don't now what to do with this however : https://github.com/ansible-collections/community.vmware/blob/main/plugins/module_utils/vmware.py#L1669 I didn't read the code in depth but shouldn't the SDRS recommended datastore follow the same code path ? |
recheck |
recheck |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @Tireg!
Build succeeded (gate pipeline). ✔️ ansible-tox-linters SUCCESS in 3m 55s |
Backport vmware_guest_disk: Avoid using in maintenance DS Backport #1321 SUMMARY Avoid recommending in-maintenance datastores when trying to create a disk with vmware_guest_disk. 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 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
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 :
Used by https://github.com/ansible-collections/community.vmware/blob/main/plugins/modules/vmware_recommended_datastore.py#L90