When a logical switch port was deleted, the Advertised_MAC_Binding row referencing its Port_Binding could still be present at the time of deletion, causing an OVSDB referential integrity violation.
Fix this by replacing engine_noop_handler with a proper incremental handler. Signed-off-by: Alexandra Rukomoinikova <[email protected]> --- northd/en-advertised-route-sync.c | 18 ++++++++++++++++++ northd/en-advertised-route-sync.h | 2 ++ northd/inc-proc-northd.c | 5 +---- tests/ovn-northd.at | 3 +++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/northd/en-advertised-route-sync.c b/northd/en-advertised-route-sync.c index 4a8d13232..f910ebfeb 100644 --- a/northd/en-advertised-route-sync.c +++ b/northd/en-advertised-route-sync.c @@ -674,6 +674,24 @@ dynamic_routes_northd_change_handler(struct engine_node *node, void *data_) return EN_HANDLED_UNCHANGED; } +enum engine_input_handler_result +dynamic_routes_adv_mac_northd_change_handler(struct engine_node *node, void *data_ OVS_UNUSED) +{ + struct northd_data *northd_data = engine_get_input_data("northd", node); + struct northd_tracked_data *trk_data = &northd_data->trk_data; + if (!northd_has_tracked_data(trk_data)) { + return EN_UNHANDLED; + } + + if (!hmapx_is_empty(&northd_data->trk_data.trk_lsps.created) || + !hmapx_is_empty(&northd_data->trk_data.trk_lsps.updated) || + !hmapx_is_empty(&northd_data->trk_data.trk_lsps.deleted)) { + return EN_UNHANDLED; + } + + return EN_HANDLED_UNCHANGED; +} + static bool should_advertise_route(const struct ovn_datapath *advertising_od, const struct ovn_port *advertising_op, diff --git a/northd/en-advertised-route-sync.h b/northd/en-advertised-route-sync.h index 71cd417de..6c274748e 100644 --- a/northd/en-advertised-route-sync.h +++ b/northd/en-advertised-route-sync.h @@ -43,6 +43,8 @@ dynamic_routes_northd_change_handler(struct engine_node *node, void *data_); enum engine_input_handler_result dynamic_routes_lr_stateful_change_handler(struct engine_node *node, void *data_); +enum engine_input_handler_result +dynamic_routes_adv_mac_northd_change_handler(struct engine_node *, void * OVS_UNUSED); void *en_advertised_mac_binding_sync_init(struct engine_node *, struct engine_arg *); diff --git a/northd/inc-proc-northd.c b/northd/inc-proc-northd.c index a2b464411..a91a7011a 100644 --- a/northd/inc-proc-northd.c +++ b/northd/inc-proc-northd.c @@ -364,11 +364,8 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb, NULL); engine_add_input(&en_advertised_mac_binding_sync, &en_sb_advertised_mac_binding, NULL); - /* No need for an explicit handler for northd changes. - * We do need to access en_northd (input) data, i.e., to - * lookup OVN ports. */ engine_add_input(&en_advertised_mac_binding_sync, &en_northd, - engine_noop_handler); + dynamic_routes_adv_mac_northd_change_handler); engine_add_input(&en_learned_route_sync, &en_sb_learned_route, learned_route_sync_sb_learned_route_change_handler); diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at index f87b14c9a..55e242995 100644 --- a/tests/ovn-northd.at +++ b/tests/ovn-northd.at @@ -20231,6 +20231,9 @@ check_row_count Advertised_MAC_Binding 1 check ovn-nbctl --wait=sb clear logical_switch ls-evpn other_config check_row_count Advertised_MAC_Binding 0 +AT_CHECK([grep -c "referential integrity violation" northd/ovn-northd.log], [1], [0 +]) + OVN_CLEANUP_NORTHD AT_CLEANUP ]) -- 2.48.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
