diff mbox series

[ovs-dev] controller: throttle port claim attempts from if-status

Message ID 20230918164614.3144765-1-xsimonar@redhat.com
State Accepted
Delegated to: Dumitru Ceara
Headers show
Series [ovs-dev] controller: throttle port claim attempts from if-status | 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 Sept. 18, 2023, 4:46 p.m. UTC
A recent commit (4dc4bc7f) throttled the port claim attemps from the binding module
when multiple chassis were fighting for the same port.
However, the if-status module was also sometimes fighting for the same ports.
Fix this by having the if-status module postponing claims in a similar way as the binding module.

Signed-off-by: Xavier Simonart <xsimonar@redhat.com>
---
 controller/binding.c   |  2 +-
 controller/binding.h   |  3 +++
 controller/if-status.c | 11 ++++++++++-
 3 files changed, 14 insertions(+), 2 deletions(-)

Comments

Dumitru Ceara Oct. 10, 2023, 1:33 p.m. UTC | #1
On 9/18/23 18:46, Xavier Simonart wrote:
> A recent commit (4dc4bc7f) throttled the port claim attemps from the binding module
> when multiple chassis were fighting for the same port.
> However, the if-status module was also sometimes fighting for the same ports.
> Fix this by having the if-status module postponing claims in a similar way as the binding module.
> 
> Signed-off-by: Xavier Simonart <xsimonar@redhat.com>
> ---

Hi Xavier,

Thanks for the patch, I applied it to main and backported to stable
branches down to and including 22.09.  There were more complex merge
conflicts on earlier branches.  Do we need a custom backport there?

Thanks,
Dumitru
diff mbox series

Patch

diff --git a/controller/binding.c b/controller/binding.c
index fd08aaafa..dda4c9162 100644
--- a/controller/binding.c
+++ b/controller/binding.c
@@ -1299,7 +1299,7 @@  remove_additional_chassis(const struct sbrec_port_binding *pb,
     remove_additional_encap_for_chassis(pb, chassis_rec);
 }
 
-static bool
+bool
 lport_maybe_postpone(const char *port_name, long long int now,
                      struct sset *postponed_ports)
 {
diff --git a/controller/binding.h b/controller/binding.h
index 47df668a2..d10eeec1f 100644
--- a/controller/binding.h
+++ b/controller/binding.h
@@ -258,4 +258,7 @@  void update_qos(struct ovsdb_idl_index * sbrec_port_binding_by_name,
                 const struct ovsrec_open_vswitch_table *ovs_table,
                 const struct ovsrec_bridge_table *bridge_table);
 
+bool lport_maybe_postpone(const char *port_name, long long int now,
+                          struct sset *postponed_ports);
+
 #endif /* controller/binding.h */
diff --git a/controller/if-status.c b/controller/if-status.c
index 6c5afc866..6f14549c8 100644
--- a/controller/if-status.c
+++ b/controller/if-status.c
@@ -474,6 +474,11 @@  if_status_mgr_update(struct if_status_mgr *mgr,
         if (!local_bindings_pb_chassis_is_set(bindings, iface->id,
             chassis_rec)) {
             if (!sb_readonly) {
+                long long int now = time_msec();
+                if (lport_maybe_postpone(iface->id, now,
+                                         get_postponed_ports())) {
+                    continue;
+                }
                 local_binding_set_pb(bindings, iface->id, chassis_rec,
                                      NULL, true, iface->bind_type);
             } else {
@@ -510,9 +515,13 @@  if_status_mgr_update(struct if_status_mgr *mgr,
     if (!sb_readonly) {
         HMAPX_FOR_EACH_SAFE (node, &mgr->ifaces_per_state[OIF_INSTALL_FLOWS]) {
             struct ovs_iface *iface = node->data;
-
             if (!local_bindings_pb_chassis_is_set(bindings, iface->id,
                 chassis_rec)) {
+                long long int now = time_msec();
+                if (lport_maybe_postpone(iface->id, now,
+                                         get_postponed_ports())) {
+                    continue;
+                }
                 local_binding_set_pb(bindings, iface->id, chassis_rec,
                                      NULL, true, iface->bind_type);
             }