Register a noop change handler for the en_sb_dns input to the northd engine node. When SB DNS records are modified directly (outside of northd), the noop handler avoids triggering an unnecessary full recompute. Northd will correct any stale SB DNS state on the next recompute.
Signed-off-by: Lana Honcharuk <[email protected]> Assisted-by: Claude Opus 4.6 --- northd/inc-proc-northd.c | 7 ++++++- tests/ovn-northd.at | 45 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/northd/inc-proc-northd.c b/northd/inc-proc-northd.c index 10bad4bab..640b60c89 100644 --- a/northd/inc-proc-northd.c +++ b/northd/inc-proc-northd.c @@ -263,7 +263,12 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb, engine_add_input(&en_northd, &en_sb_chassis, NULL); engine_add_input(&en_northd, &en_sb_mirror, NULL); engine_add_input(&en_northd, &en_sb_meter, NULL); - engine_add_input(&en_northd, &en_sb_dns, NULL); + + /* en_northd is the only writer to the SB DNS table, so any + * changes detected here are from northd's own previous + * transaction and can be safely ignored. */ + engine_add_input(&en_northd, &en_sb_dns, engine_noop_handler); + engine_add_input(&en_northd, &en_sb_ha_chassis_group, NULL); engine_add_input(&en_northd, &en_sb_service_monitor, NULL); engine_add_input(&en_northd, &en_sb_static_mac_binding, NULL); diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at index a8b5436ba..827f92914 100644 --- a/tests/ovn-northd.at +++ b/tests/ovn-northd.at @@ -18327,6 +18327,51 @@ OVN_CLEANUP_NORTHD AT_CLEANUP ]) +OVN_FOR_EACH_NORTHD_NO_HV([ +AT_SETUP([SB DNS incremental processing]) +ovn_start + +check ovn-nbctl --wait=sb ls-add sw0 + +# Create NB DNS record and associate it with sw0. +dns_uuid=$(ovn-nbctl create DNS records:vm1.ovn.org="10.0.0.4") +check ovn-nbctl set Logical_Switch sw0 dns_records="$dns_uuid" +check ovn-nbctl --wait=sb sync + +# Verify SB DNS entry was created with correct records. +sb_dns_uuid=$(fetch_column sb:DNS _uuid) +check test -n "$sb_dns_uuid" +wait_column '{"vm1.ovn.org"="10.0.0.4"}' sb:DNS records + +# Verify DNS lookup and response flows exist. +AT_CHECK([ovn-sbctl dump-flows sw0 | grep -c "dns_lookup\|dns_response" | grep -q '[1-9]']) + +# Directly modify the SB DNS records field. The noop handler should +# not trigger a recompute, so the stale value persists until a +# recompute corrects it. +check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats +check ovn-sbctl set DNS $sb_dns_uuid records:vm2.ovn.org="10.0.0.5" +check ovn-nbctl --wait=sb sync +check_engine_stats northd norecompute compute +check_engine_stats lflow norecompute nocompute + +# The stale record should still be present since northd did not recompute. +AT_CHECK([ovn-sbctl get DNS $sb_dns_uuid records:vm2.ovn.org], [0], [dnl +"10.0.0.5" +]) + +# Force a recompute and verify northd corrects the SB DNS records +# back to what NB defines (only vm1.ovn.org). +check as northd ovn-appctl -t ovn-northd inc-engine/recompute +check ovn-nbctl --wait=sb sync +wait_column '{"vm1.ovn.org"="10.0.0.4"}' sb:DNS records + +# Verify DNS flows are still correct after recompute. +AT_CHECK([ovn-sbctl dump-flows sw0 | grep -c "dns_lookup\|dns_response" | grep -q '[1-9]']) + +AT_CLEANUP +]) + OVN_FOR_EACH_NORTHD_NO_HV([ AT_SETUP([ip_port_mappings validation: IPv4]) ovn_start -- 2.39.5 (Apple Git-154) _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
