-
Notifications
You must be signed in to change notification settings - Fork 36
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
na_ontap_broadcast_domain doesnt correctly modifying a broadcast domain's ports using REST #210
Comments
hi @hashi825, |
Hey @csahu1 thats not the issue, the module is attempting to remove existing ports in the broadcast domain instead of adding the missing ports. I've pointed the problem out in the code. This doesn't happen when using the module in ZAPI as the ZAPI call in this situation would add ports where as the REST function uses a PATCH request which would run on the existing ports in the list resulting in attempting to remove the ports. |
@hashi825 sorry this fell through the cracks. I'll have the team look at this and get back to you I have DEVOPS-7088 open for this. |
@hashi825 Could you confirm if this behaviour is not seen in your case? If not, could you share the steps to reproduce the issue? |
It's in the initial post and I've highlighted the code issue. The module is taking the existing list and performing a patch requests on ports that exist in the broadcast domain that are in the provided variable. They should not be touched as they are meant to exist when state present is specified, a patch request either removes or adds a port the operation should not be performed at all when the module encounters a port in the input list that already is a member of the requested broadcast domain |
@hashi825 The patch request that is referenced in your query calls API |
Actually looks like I found where the issue lies, this function here returns the ports for the add operation on the broadcast domain The ports_to_add_move_from_desired function is splitting the port name, this then matches on
which causes existing ports to be added. The reason this happening looks like due to the port names, splitting on port name which removes the node reference is a very poor way of figuring out which ports need to be modified in a broadcast domain because ports across nodes are usually the same especially when using interface groups. |
We've applied a fix for this; it would mostly be a part of the next release. |
Summary
When providing a broadcast domain that already contains existing ports and requires adding new ports, using REST will add ALL ports to the REST Patch request due to this statement which prevents actually only returning the ports to add
netapp.ontap/plugins/modules/na_ontap_broadcast_domain.py
Lines 586 to 599 in 78486a1
netapp.ontap/plugins/modules/na_ontap_broadcast_domain.py
Lines 466 to 474 in 78486a1
ports_to_add
provides the correct list of ports to addget_ports_rest
then checksself.desired_ports
which contains all ports found from theports
parameter of the module. This causes the module to send a patch request toapi/network/ethernet/ports
that essentially removes/readds ports that were already in the broadcast domain.Removing the if statement seems to provide the desired behaviour.
Component Name
na_ontap_broadcast_domain
Ansible Version
ONTAP Collection Version
ONTAP Version
Playbook
Steps to Reproduce
Expected Results
Expected that module will only add MISSING broadcast domain ports and not try and PATCH existing ports.
Actual Results
msg: 'calling: network/ethernet/ports/fbec63a4-af37-11eb-b786-00a098dc46e4: got {''message'': ''Port "###:a1a-111" cannot be used because it is currently the home port or current port of a LIF.'', ''code'': ''1377608''}.'
The text was updated successfully, but these errors were encountered: