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 <xsimo...@redhat.com>
---
 controller/binding.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

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.
      */
-- 
2.31.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to