The commit ed09854e5b3 ("ovn-northd: Add the option to configure probe
interval") introduced the option northd-probe-interval to configure
ovn-northd probe interval with NB/SB DBs. However, it overrided the
default behavior that it used before - setting default probe interval
according to stream type. E.g., for unix socket, probe was disabled by default
but with the change it defaults to 5 seconds, if the option
northd-probe-interval is not set.This patch restores the default behavior, while honoring the settings of northd-probe-interval when it is configured. Signed-off-by: Han Zhou <[email protected]> --- northd/ovn-northd.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c index 99eb582..476ef9b 100644 --- a/northd/ovn-northd.c +++ b/northd/ovn-northd.c @@ -96,7 +96,8 @@ static struct eth_addr svc_monitor_mac_ea; /* Default probe interval for NB and SB DB connections. */ #define DEFAULT_PROBE_INTERVAL_MSEC 5000 -static int northd_probe_interval = DEFAULT_PROBE_INTERVAL_MSEC; +static int northd_probe_interval_nb = DEFAULT_PROBE_INTERVAL_MSEC; +static int northd_probe_interval_sb = DEFAULT_PROBE_INTERVAL_MSEC; #define MAX_OVN_TAGS 4096 @@ -11597,6 +11598,20 @@ build_meter_groups(struct northd_context *ctx, } } +static int +get_probe_interval(const char *db, const struct nbrec_nb_global *nb) +{ + int default_interval = (db && !stream_or_pstream_needs_probes(db) + ? 0 : DEFAULT_PROBE_INTERVAL_MSEC); + int interval = smap_get_int(&nb->options, + "northd_probe_interval", default_interval); + + if (interval > 0 && interval < 1000) { + interval = 1000; + } + return interval; +} + static void ovnnb_db_run(struct northd_context *ctx, struct ovsdb_idl_index *sbrec_chassis_by_name, @@ -11680,12 +11695,8 @@ ovnnb_db_run(struct northd_context *ctx, } /* Update the probe interval. */ - northd_probe_interval = smap_get_int(&nb->options, "northd_probe_interval", - DEFAULT_PROBE_INTERVAL_MSEC); - - if (northd_probe_interval > 0 && northd_probe_interval < 1000) { - northd_probe_interval = 1000; - } + northd_probe_interval_nb = get_probe_interval(ovnnb_db, nb); + northd_probe_interval_sb = get_probe_interval(ovnsb_db, nb); controller_event_en = smap_get_bool(&nb->options, "controller_event", false); @@ -12670,8 +12681,10 @@ main(int argc, char *argv[]) } - ovsdb_idl_set_probe_interval(ovnnb_idl_loop.idl, northd_probe_interval); - ovsdb_idl_set_probe_interval(ovnsb_idl_loop.idl, northd_probe_interval); + ovsdb_idl_set_probe_interval(ovnnb_idl_loop.idl, + northd_probe_interval_nb); + ovsdb_idl_set_probe_interval(ovnsb_idl_loop.idl, + northd_probe_interval_sb); if (reset_ovnsb_idl_min_index) { VLOG_INFO("Resetting southbound database cluster state"); -- 2.1.0 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
