@@ -681,6 +681,7 @@ local_binding_is_down(struct shash *local_bindings, const char *pb_name)
void
local_binding_set_up(struct shash *local_bindings, const char *pb_name,
+ const struct sbrec_chassis *chassis_rec,
const char *ts_now_str, bool sb_readonly,
bool ovs_readonly)
{
@@ -700,8 +701,9 @@ local_binding_set_up(struct shash *local_bindings, const char *pb_name,
ts_now_str);
}
- if (!sb_readonly && lbinding && b_lport && b_lport->pb->n_up
- && !b_lport->pb->up[0]) {
+ if (!sb_readonly && lbinding && b_lport && b_lport->pb->n_up &&
+ !b_lport->pb->up[0] &&
+ (!b_lport->pb->chassis || b_lport->pb->chassis == chassis_rec)) {
VLOG_INFO("Setting lport %s up in Southbound", pb_name);
binding_lport_set_up(b_lport, sb_readonly);
LIST_FOR_EACH (b_lport, list_node, &lbinding->binding_lports) {
@@ -712,6 +714,7 @@ local_binding_set_up(struct shash *local_bindings, const char *pb_name,
void
local_binding_set_down(struct shash *local_bindings, const char *pb_name,
+ const struct sbrec_chassis *chassis_rec,
bool sb_readonly, bool ovs_readonly)
{
struct local_binding *lbinding =
@@ -726,7 +729,8 @@ local_binding_set_down(struct shash *local_bindings, const char *pb_name,
OVN_INSTALLED_EXT_ID);
}
- if (!sb_readonly && b_lport && b_lport->pb->n_up && b_lport->pb->up[0]) {
+ if (!sb_readonly && b_lport && b_lport->pb->n_up && b_lport->pb->up[0] &&
+ (!b_lport->pb->chassis || b_lport->pb->chassis == chassis_rec)) {
VLOG_INFO("Setting lport %s down in Southbound", pb_name);
binding_lport_set_down(b_lport, sb_readonly);
LIST_FOR_EACH (b_lport, list_node, &lbinding->binding_lports) {
@@ -154,9 +154,11 @@ ofp_port_t local_binding_get_lport_ofport(const struct shash *local_bindings,
bool local_binding_is_up(struct shash *local_bindings, const char *pb_name);
bool local_binding_is_down(struct shash *local_bindings, const char *pb_name);
void local_binding_set_up(struct shash *local_bindings, const char *pb_name,
+ const struct sbrec_chassis *chassis_rec,
const char *ts_now_str, bool sb_readonly,
bool ovs_readonly);
void local_binding_set_down(struct shash *local_bindings, const char *pb_name,
+ const struct sbrec_chassis *chassis_rec,
bool sb_readonly, bool ovs_readonly);
void binding_register_ovs_idl(struct ovsdb_idl *);
@@ -115,6 +115,7 @@ static void ovs_iface_set_state(struct if_status_mgr *, struct ovs_iface *,
static void if_status_mgr_update_bindings(
struct if_status_mgr *mgr, struct local_binding_data *binding_data,
+ const struct sbrec_chassis *,
bool sb_readonly, bool ovs_readonly);
struct if_status_mgr *
@@ -311,6 +312,7 @@ if_status_mgr_update(struct if_status_mgr *mgr,
void
if_status_mgr_run(struct if_status_mgr *mgr,
struct local_binding_data *binding_data,
+ const struct sbrec_chassis *chassis_rec,
bool sb_readonly, bool ovs_readonly)
{
struct ofctrl_acked_seqnos *acked_seqnos =
@@ -335,8 +337,8 @@ if_status_mgr_run(struct if_status_mgr *mgr,
ofctrl_acked_seqnos_destroy(acked_seqnos);
/* Update binding states. */
- if_status_mgr_update_bindings(mgr, binding_data, sb_readonly,
- ovs_readonly);
+ if_status_mgr_update_bindings(mgr, binding_data, chassis_rec,
+ sb_readonly, ovs_readonly);
}
static void
@@ -397,6 +399,7 @@ ovs_iface_set_state(struct if_status_mgr *mgr, struct ovs_iface *iface,
static void
if_status_mgr_update_bindings(struct if_status_mgr *mgr,
struct local_binding_data *binding_data,
+ const struct sbrec_chassis *chassis_rec,
bool sb_readonly, bool ovs_readonly)
{
if (!binding_data) {
@@ -412,7 +415,8 @@ if_status_mgr_update_bindings(struct if_status_mgr *mgr,
HMAPX_FOR_EACH (node, &mgr->ifaces_per_state[OIF_INSTALL_FLOWS]) {
struct ovs_iface *iface = node->data;
- local_binding_set_down(bindings, iface->id, sb_readonly, ovs_readonly);
+ local_binding_set_down(bindings, iface->id, chassis_rec,
+ sb_readonly, ovs_readonly);
}
/* Notifiy the binding module to set "up" all bindings that have had
@@ -423,7 +427,7 @@ if_status_mgr_update_bindings(struct if_status_mgr *mgr,
HMAPX_FOR_EACH (node, &mgr->ifaces_per_state[OIF_MARK_UP]) {
struct ovs_iface *iface = node->data;
- local_binding_set_up(bindings, iface->id, ts_now_str,
+ local_binding_set_up(bindings, iface->id, chassis_rec, ts_now_str,
sb_readonly, ovs_readonly);
}
free(ts_now_str);
@@ -434,7 +438,8 @@ if_status_mgr_update_bindings(struct if_status_mgr *mgr,
HMAPX_FOR_EACH (node, &mgr->ifaces_per_state[OIF_MARK_DOWN]) {
struct ovs_iface *iface = node->data;
- local_binding_set_down(bindings, iface->id, sb_readonly, ovs_readonly);
+ local_binding_set_down(bindings, iface->id, chassis_rec,
+ sb_readonly, ovs_readonly);
}
}
@@ -33,6 +33,7 @@ void if_status_mgr_delete_iface(struct if_status_mgr *, const char *iface_id);
void if_status_mgr_update(struct if_status_mgr *, struct local_binding_data *);
void if_status_mgr_run(struct if_status_mgr *mgr, struct local_binding_data *,
+ const struct sbrec_chassis *,
bool sb_readonly, bool ovs_readonly);
void if_status_mgr_get_memory_usage(struct if_status_mgr *mgr,
struct simap *usage);
@@ -3783,8 +3783,8 @@ main(int argc, char *argv[])
time_msec());
stopwatch_start(IF_STATUS_MGR_RUN_STOPWATCH_NAME,
time_msec());
- if_status_mgr_run(if_mgr, binding_data, !ovnsb_idl_txn,
- !ovs_idl_txn);
+ if_status_mgr_run(if_mgr, binding_data, chassis,
+ !ovnsb_idl_txn, !ovs_idl_txn);
stopwatch_stop(IF_STATUS_MGR_RUN_STOPWATCH_NAME,
time_msec());
}
In a future patch, there will be a scenario where the same port has attachments at multiple (specifically, 2) chassis, so make sure that 'up' property is updated by the main chassis only. Signed-off-by: Ihar Hrachyshka <ihrachys@redhat.com> --- controller/binding.c | 10 +++++++--- controller/binding.h | 2 ++ controller/if-status.c | 15 ++++++++++----- controller/if-status.h | 1 + controller/ovn-controller.c | 4 ++-- 5 files changed, 22 insertions(+), 10 deletions(-)