diff mbox series

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

Message ID 20240723155444.2530187-4-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 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(-)

Comments

Numan Siddique July 30, 2024, 8:38 p.m. UTC | #1
On Tue, Jul 23, 2024 at 11:55 AM Xavier Simonart <xsimonar@redhat.com> wrote:
>
> 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 --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);

Thanks for the patch.  The function remove_pb_from_local_datapath() also calls
remove_related_lport().  So I applied this patch with the below changes


-----
diff --git a/controller/binding.c b/controller/binding.c
index 1bb4cf8649..a7bbd24435 100644
--- a/controller/binding.c
+++ b/controller/binding.c
@@ -2732,7 +2732,6 @@ 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,
@@ -2750,6 +2749,12 @@ handle_deleted_lport(const struct sbrec_port_binding *pb,
         return;
     }

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

-----

Numan

>      /* 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
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
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.
      */