diff mbox series

[ovs-dev,3/7] binding: Cleanup related_lports for deleted ports.

Message ID 20240719153603.2914663-4-xsimonar@redhat.com
State Superseded
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 19, 2024, 3:35 p.m. UTC
When a port is deleted, remove it from the related ports.
Some ports, such a l3gw ports for non local datapaths, can be related
while not belonging to a local datapath. Remove such ports from
related_lports when they are deleted.

Some tests, such as "delete mac bindings" or
"router port add then remove - distributed router gateway port" were already
testing such scenarios, but were were checking whether related_lports 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 | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/controller/binding.c b/controller/binding.c
index 97f4545a4..1bb5cca52 100644
--- a/controller/binding.c
+++ b/controller/binding.c
@@ -2734,6 +2734,7 @@  handle_deleted_lport(const struct sbrec_port_binding *pb,
                      struct binding_ctx_in *b_ctx_in,
                      struct binding_ctx_out *b_ctx_out)
 {
+    remove_related_lport(pb, b_ctx_out);
     /* If the binding is local, remove it. */
     struct local_datapath *ld =
         get_local_datapath(b_ctx_out->local_datapaths,
@@ -2751,15 +2752,6 @@  handle_deleted_lport(const struct sbrec_port_binding *pb,
         return;
     }
 
-    /*
-     * Remove localport that was part of local datapath that is not
-     * considered to be local anymore.
-     */
-    if (!ld && !strcmp(pb->type, "localport") &&
-        sset_find(&b_ctx_out->related_lports->lport_names, pb->logical_port)) {
-        remove_related_lport(pb, b_ctx_out);
-    }
-
     /* If the binding is not local, if 'pb' is a L3 gateway port, we should
      * remove its peer, if that one is local.
      */