diff mbox series

[ovs-dev,v2,5/7] binding: Cleanup related ports on port type change.

Message ID 20240723155444.2530187-6-xsimonar@redhat.com
State Accepted
Delegated to: Numan Siddique
Headers show
Series pmtud and related ports. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_ovn-kubernetes fail github build: failed

Commit Message

Xavier Simonart July 23, 2024, 3:54 p.m. UTC
When a port type is changed from e.g. patch (which is a related_port)
to VIF which can be claimed by another chassis, then the port
should be removed from the related_ports set.

Test "ovn-controller local bindings" was already testing this
but not checking whether related_ports were correct.
This will be automatically tested when related_lports will be checked
at the end of the tests, in a following	patch.

Signed-off-by: Xavier Simonart <xsimonar@redhat.com>
---
 controller/binding.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/controller/binding.c b/controller/binding.c
index 210809944..1f3f74998 100644
--- a/controller/binding.c
+++ b/controller/binding.c
@@ -2969,6 +2969,13 @@  handle_updated_port(struct binding_ctx_in *b_ctx_in,
     case LP_VIF:
     case LP_CONTAINER:
     case LP_VIRTUAL:
+        /* If port binding type just changed, port might be a "related_lport"
+         * while it should not. Remove it from that set. It will be added
+         * back later if needed.
+         */
+        if (sbrec_port_binding_is_updated(pb, SBREC_PORT_BINDING_COL_TYPE)) {
+            remove_related_lport(pb, b_ctx_out);
+        }
         update_ld_multichassis_ports(pb, b_ctx_out->local_datapaths);
         handled = handle_updated_vif_lport(pb, lport_type, b_ctx_in,
                                            b_ctx_out);