-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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: Add support in VMWare modules for BIOS and instance UUID's #44399
Conversation
Hi @naphta, Thank you for the pullrequest, just so you are aware we have a dedicated Working Group for vmware. |
This comment has been minimized.
This comment has been minimized.
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.
Bunch of changes required. I'm also missing test cases for all the modules you have changed (because it would have identified a few issues, i think).
lib/ansible/modules/cloud/vmware/vmware_guest_custom_attributes.py
Outdated
Show resolved
Hide resolved
lib/ansible/modules/cloud/vmware/vmware_guest_snapshot_facts.py
Outdated
Show resolved
Hide resolved
Also think that this could be achieved with a boolean instead of a choice attribute, cc @Akasurde |
Boolean probably makes sense in hindsight (I'm sure vmware are unlikely to add another UUID).
I could also wrap this functionality to be invisible so that it tries the BIOS UUID first then if nothing returns it continues with the instance UUID; I didn't do that originally just because it seemed a bit heavy, but asides from speed concerns it would make the user interface pretty simple. The UUID could also just be prefixed My intention is to flesh out all of the test cases I just got the pull request open to start working on any of the already existing issues. |
@naphta, doing it transparent seems a bit dangerous. It's better, in my opinion, to give the choice. I do like the boolean approach more. I'd suggest Thanks! |
Had a quick run at converting it to use a boolean, I'll look at fleshing out the tests in the coming days. I'm not especially familar with the project but are there any tests beyond the integration ones I need to concern myself with? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I couldn't see any other integration tests which refer to the UUID other than the one I already included. |
ready_for_review |
The above if statment was incorrectly including both instance and bios uuid’s, I’ve added a negate clause so each one will be hit correctly.
Fixes: ansible#46460 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
f72856d
to
2ef063c
Compare
For what it's worth I did add a test in for this using the VMWare mock API included. |
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
Cool improvement :)
Closing and re-opening for CI trigger. |
@naphta Thanks for the contribution. @pdellaert @dagwieers Thanks for the reviews. |
SUMMARY
Adding support for specifying the type of UUID to match against, by default it will continue to use the bios UUID which originally was the only one which worked.
ISSUE TYPE
COMPONENT NAME
lib/ansible/module_utils/vmware.py
lib/ansible/modules/cloud/vmware/vmware_guest_boot_facts.py
lib/ansible/modules/cloud/vmware/vmware_guest_boot_manager.py
lib/ansible/modules/cloud/vmware/vmware_guest_custom_attributes.py
lib/ansible/modules/cloud/vmware/vmware_guest_disk_facts.py
lib/ansible/modules/cloud/vmware/vmware_guest_facts.py
lib/ansible/modules/cloud/vmware/vmware_guest_file_operation.py
lib/ansible/modules/cloud/vmware/vmware_guest_find.py
lib/ansible/modules/cloud/vmware/vmware_guest_move.py
lib/ansible/modules/cloud/vmware/vmware_guest_powerstate.py
lib/ansible/modules/cloud/vmware/vmware_guest_snapshot.py
lib/ansible/modules/cloud/vmware/vmware_guest_snapshot_facts.py
lib/ansible/modules/cloud/vmware/vmware_guest_tools_wait.py
lib/ansible/modules/cloud/vmware/vmware_vm_shell.py
lib/ansible/modules/cloud/vmware/vmware_vmotion.py
test/integration/targets/vmware_guest_facts/tasks/main.yml
ANSIBLE VERSION
ADDITIONAL INFORMATION
I've put this in (and to every referenced module) to increase the options of how you can refer to a VM. In-house where I work we created a lot of VMWare modules before they were available directly from Ansible so in doing this we personally can migrate to Ansible code more easily. Broadly speaking it seemed logical to support either kind of UUID as in PyVmomi it boils down to a true/false to determine which one it searched on.