diff mbox series

[ovs-dev,1/5] controller: Fix iface-id-ver handling.

Message ID 20240423115333.2796843-2-xsimonar@redhat.com
State Accepted
Delegated to: Numan Siddique
Headers show
Series Fix I+P versus recompute differences. | 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 April 23, 2024, 11:53 a.m. UTC
If iface-id-ver was wrong and modified to a correct value,
the port was correctly claimed, but the flows were not installed
by I+P.

Signed-off-by: Xavier Simonart <xsimonar@redhat.com>
---
 controller/binding.c | 14 ++++++++++++++
 tests/ovn.at         |  2 ++
 2 files changed, 16 insertions(+)

Comments

Numan Siddique May 30, 2024, 3:27 p.m. UTC | #1
On Tue, Apr 23, 2024 at 7:53 AM Xavier Simonart <xsimonar@redhat.com> wrote:
>
> If iface-id-ver was wrong and modified to a correct value,
> the port was correctly claimed, but the flows were not installed
> by I+P.
>
> Signed-off-by: Xavier Simonart <xsimonar@redhat.com>

Acked-by: Numan Siddique <numans@ovn.org>

Numan

> ---
>  controller/binding.c | 14 ++++++++++++++
>  tests/ovn.at         |  2 ++
>  2 files changed, 16 insertions(+)
>
> diff --git a/controller/binding.c b/controller/binding.c
> index 8ac2ce3e2..c9658cb2a 100644
> --- a/controller/binding.c
> +++ b/controller/binding.c
> @@ -757,6 +757,8 @@ update_active_pb_ras_pd(const struct sbrec_port_binding *pb,
>      }
>  }
>
> +static bool is_ext_id_changed(const struct smap *a, const struct smap *b,
> +                              const char *key);
>  static struct local_binding *local_binding_create(
>      const char *name, const struct ovsrec_interface *);
>  static void local_binding_add(struct shash *local_bindings,
> @@ -2311,6 +2313,18 @@ consider_iface_claim(const struct ovsrec_interface *iface_rec,
>          return true;
>      }
>
> +    /* Check if iface-id-ver just becomes correct */
> +    struct smap *external_ids_old =
> +        shash_find_data(b_ctx_in->iface_table_external_ids_old,
> +                        iface_rec->name);
> +
> +    if (external_ids_old &&
> +        is_ext_id_changed(&iface_rec->external_ids,
> +                          external_ids_old,
> +                          "iface-id-ver")) {
> +            b_ctx_out->local_lports_changed = true;
> +    }
> +
>      /* If multiple bindings to the same port, remove the "old" binding.
>       * This ensures that change tracking is correct.
>       */
> diff --git a/tests/ovn.at b/tests/ovn.at
> index e81cd4f45..f974cbb15 100644
> --- a/tests/ovn.at
> +++ b/tests/ovn.at
> @@ -33239,6 +33239,8 @@ check as hv1 ovs-vsctl set interface vif11 external_ids:iface-id-ver=foo
>
>  wait_for_ports_up sw0-port1
>
> +CHECK_FLOWS_AFTER_RECOMPUTE([hv1], [hv1])
> +
>  AT_CHECK([as hv1 ovn-appctl -t ovn-controller debug/dump-local-bindings], [0], [dnl
>  Local bindings:
>  name: [[sw0-port1]], OVS interface name : [[vif11]], num binding lports : [[1]]
> --
> 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 8ac2ce3e2..c9658cb2a 100644
--- a/controller/binding.c
+++ b/controller/binding.c
@@ -757,6 +757,8 @@  update_active_pb_ras_pd(const struct sbrec_port_binding *pb,
     }
 }
 
+static bool is_ext_id_changed(const struct smap *a, const struct smap *b,
+                              const char *key);
 static struct local_binding *local_binding_create(
     const char *name, const struct ovsrec_interface *);
 static void local_binding_add(struct shash *local_bindings,
@@ -2311,6 +2313,18 @@  consider_iface_claim(const struct ovsrec_interface *iface_rec,
         return true;
     }
 
+    /* Check if iface-id-ver just becomes correct */
+    struct smap *external_ids_old =
+        shash_find_data(b_ctx_in->iface_table_external_ids_old,
+                        iface_rec->name);
+
+    if (external_ids_old &&
+        is_ext_id_changed(&iface_rec->external_ids,
+                          external_ids_old,
+                          "iface-id-ver")) {
+            b_ctx_out->local_lports_changed = true;
+    }
+
     /* If multiple bindings to the same port, remove the "old" binding.
      * This ensures that change tracking is correct.
      */
diff --git a/tests/ovn.at b/tests/ovn.at
index e81cd4f45..f974cbb15 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -33239,6 +33239,8 @@  check as hv1 ovs-vsctl set interface vif11 external_ids:iface-id-ver=foo
 
 wait_for_ports_up sw0-port1
 
+CHECK_FLOWS_AFTER_RECOMPUTE([hv1], [hv1])
+
 AT_CHECK([as hv1 ovn-appctl -t ovn-controller debug/dump-local-bindings], [0], [dnl
 Local bindings:
 name: [[sw0-port1]], OVS interface name : [[vif11]], num binding lports : [[1]]