From 42353552f409238bbbd23833e6446317684511e0 Mon Sep 17 00:00:00 2001 From: Xavier Simonart Date: Tue, 23 Apr 2024 13:53:29 +0200 Subject: [PATCH] controller: Fix iface-id-ver handling. 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 Signed-off-by: Numan Siddique --- controller/binding.c | 14 ++++++++++++++ tests/ovn.at | 2 ++ 2 files changed, 16 insertions(+) diff --git a/controller/binding.c b/controller/binding.c index 0712d70307..d02e5cf45d 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 af0eaeed35..b14233085b 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -33276,6 +33276,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]]