Skip to content

Commit

Permalink
ovn-northd: By default don't enable probe for unix socket.
Browse files Browse the repository at this point in the history
The commit ed09854 ("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.

Acked-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Han Zhou <hzhou@ovn.org>
  • Loading branch information
hzhou8 committed Aug 25, 2020
1 parent ea6b7f0 commit edf3baa
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions northd/ovn-northd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -11619,6 +11620,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,
Expand Down Expand Up @@ -11702,12 +11717,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);
Expand Down Expand Up @@ -12724,8 +12735,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");
Expand Down

0 comments on commit edf3baa

Please sign in to comment.