OVN checks whether ovn-installed is already present (in OVS) before updating it. This might cause ovn-installed related issues in the following case: - (1) ovn-installed is present - (2) we claim the interface - (3) we update ovs, removing ovn-installed and start installing flows - (4) (next loop), after flows installed, we check if ovn-installed is absent, and if yes, we update OVS with ovn-installed. However, in step4, if OVS is still busy from step 3, ovn-installed is read as present; hence OVN controller does not update it and move to INSTALLED state.
Note that this does not happen with writing port up in SBDB because Port status changes will hit I-P. Signed-off-by: Xavier Simonart <[email protected]> --- controller/binding.c | 14 ++++++++++---- controller/binding.h | 3 ++- controller/if-status.c | 5 +++-- controller/if-status.h | 3 ++- controller/ovn-controller.c | 2 +- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/controller/binding.c b/controller/binding.c index 2279570f9..7b01767cd 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -644,7 +644,8 @@ local_binding_get_lport_ofport(const struct shash *local_bindings, } bool -local_binding_is_up(struct shash *local_bindings, const char *pb_name) +local_binding_is_up(struct shash *local_bindings, const char *pb_name, + bool ovs_readonly) { struct local_binding *lbinding = local_binding_find(local_bindings, pb_name); @@ -653,6 +654,10 @@ local_binding_is_up(struct shash *local_bindings, const char *pb_name) if (b_lport->pb->n_up && !b_lport->pb->up[0]) { return false; } + if (ovs_readonly) { + /* We might be reading stale data from OVS */ + return false; + } return smap_get_bool(&lbinding->iface->external_ids, OVN_INSTALLED_EXT_ID, false); } @@ -1297,9 +1302,11 @@ consider_vif_lport_(const struct sbrec_port_binding *pb, const char *requested_chassis_option = smap_get( &pb->options, "requested-chassis"); VLOG_INFO_RL(&rl, - "Not claiming lport %s, chassis %s requested-chassis %s", + "Not claiming lport %s, chassis %s requested-chassis %s " + "pb->chassis %s", pb->logical_port, b_ctx_in->chassis_rec->name, - requested_chassis_option ? requested_chassis_option : "[]"); + requested_chassis_option ? requested_chassis_option : "[]", + pb->chassis ? pb->chassis->name: ""); } } @@ -1313,7 +1320,6 @@ consider_vif_lport_(const struct sbrec_port_binding *pb, b_ctx_out->if_mgr); } } - return true; } diff --git a/controller/binding.h b/controller/binding.h index 1fed06674..178a0650c 100644 --- a/controller/binding.h +++ b/controller/binding.h @@ -151,7 +151,8 @@ const struct sbrec_port_binding *local_binding_get_primary_pb( ofp_port_t local_binding_get_lport_ofport(const struct shash *local_bindings, const char *pb_name); -bool local_binding_is_up(struct shash *local_bindings, const char *pb_name); +bool local_binding_is_up(struct shash *local_bindings, const char *pb_name, + bool ovs_readonly); 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, diff --git a/controller/if-status.c b/controller/if-status.c index ad61844d8..af82d2f10 100644 --- a/controller/if-status.c +++ b/controller/if-status.c @@ -248,7 +248,8 @@ if_status_mgr_delete_iface(struct if_status_mgr *mgr, const char *iface_id) void if_status_mgr_update(struct if_status_mgr *mgr, - struct local_binding_data *binding_data) + struct local_binding_data *binding_data, + bool ovs_readonly) { if (!binding_data) { return; @@ -263,7 +264,7 @@ if_status_mgr_update(struct if_status_mgr *mgr, HMAPX_FOR_EACH_SAFE (node, &mgr->ifaces_per_state[OIF_MARK_UP]) { struct ovs_iface *iface = node->data; - if (local_binding_is_up(bindings, iface->id)) { + if (local_binding_is_up(bindings, iface->id, ovs_readonly)) { ovs_iface_set_state(mgr, iface, OIF_INSTALLED); } } diff --git a/controller/if-status.h b/controller/if-status.h index bb8a3950d..ae1641e5c 100644 --- a/controller/if-status.h +++ b/controller/if-status.h @@ -31,7 +31,8 @@ void if_status_mgr_claim_iface(struct if_status_mgr *, const char *iface_id); void if_status_mgr_release_iface(struct if_status_mgr *, const char *iface_id); 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_update(struct if_status_mgr *, struct local_binding_data *, + bool ovs_readonly); void if_status_mgr_run(struct if_status_mgr *mgr, struct local_binding_data *, const struct sbrec_chassis *, bool sb_readonly, bool ovs_readonly); diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index 2793c8687..78c7cc457 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -3999,7 +3999,7 @@ main(int argc, char *argv[]) runtime_data ? &runtime_data->lbinding_data : NULL; stopwatch_start(IF_STATUS_MGR_UPDATE_STOPWATCH_NAME, time_msec()); - if_status_mgr_update(if_mgr, binding_data); + if_status_mgr_update(if_mgr, binding_data, !ovs_idl_txn); stopwatch_stop(IF_STATUS_MGR_UPDATE_STOPWATCH_NAME, time_msec()); -- 2.31.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
