Skip to content

Commit

Permalink
controller: throttle port claim attempts from if-status
Browse files Browse the repository at this point in the history
A recent commit (4dc4bc7) 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>
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
  • Loading branch information
simonartxavier authored and dceara committed Oct 9, 2023
1 parent 8594ca1 commit f64818d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion controller/binding.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
3 changes: 3 additions & 0 deletions controller/binding.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
11 changes: 10 additions & 1 deletion controller/if-status.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit f64818d

Please sign in to comment.