-
Notifications
You must be signed in to change notification settings - Fork 341
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: Fix disk parameter validation #705
Conversation
@@ -2477,7 +2477,7 @@ def sanitize_disk_parameters(self, vm_obj): | |||
""" | |||
controllers = [] | |||
for disk_spec in self.params.get('disk'): | |||
if not disk_spec['controller_type'] or not disk_spec['controller_number'] or not disk_spec['unit_number']: |
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.
Could you please add an integration test for this change? REST LGTM
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.
@Akasurde I think there already exists a test case for controller_number
/ unit_number
0:
community.vmware/tests/integration/targets/vmware_guest/tasks/multiple_disk_controllers_d1_c1_f0.yml
Lines 21 to 30 in f913056
- controller_type: lsilogicsas | |
controller_number: 0 | |
unit_number: 0 | |
size_mb: 512 | |
type: thin | |
- controller_type: paravirtual | |
controller_number: 1 | |
unit_number: 0 | |
size_mb: 256 | |
type: eagerzeroedthick |
But I don't understand why this didn't fail in the CI :-/
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.
Oh. This test playbook is not in the vmware_guest_test_playbooks
: https://github.com/ansible-collections/community.vmware/blob/f913056612c776b6527aa3c373fe7cb7358d2762/tests/integration/targets/vmware_guest/defaults/main.yml
@@ -19,6 +19,7 @@ vmware_guest_test_playbooks: | |||
- mac_address_d1_c1_f0.yml | |||
- max_connections.yml | |||
- mem_reservation.yml | |||
- multiple_disk_controllers_d1_c1_f0.yml |
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.
+1, hopefully it won't blow things up.
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.
@goneri Unfortunately, it did blow things up. I'll try to find out why.
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.
@Akasurde @goneri I think this is yet another problem with the vCenter simulator. I have moved those tests into a when: vcsim is not defined
block.
Btw: It looks like we don't test against a real vCenter in the CI pipeline anymore. Would it be possible to get this back? It's really unfortunate that there are so many integration tests that are skipped because we only have vcsim.
@Akasurde @goneri What do you think, should we merge this PR? According to @MalfuncEddie it works and fixes the bug. |
@Akasurde @goneri Did something change in the CI? ansible-test-sanity-docker worked in ansible/check but failed in ansible/gate. |
SUMMARY
The module fails when
disk.controller_number
ordisk.unit_number
are 0.Fixes #703
ISSUE TYPE
COMPONENT NAME
vmware_guest
ADDITIONAL INFORMATION
community.vmware/plugins/modules/vmware_guest.py
Line 2480 in f913056
When
disk.controller_number
ordisk.unit_number
are 0, the module fails becausenot 0
isTrue
. 0 is a valid value, the module should only fail if these parameters are not defined at all.