The probe timer between ovn-controller and OVN Southbound can be configured using ovn-vsctl command, but that is not effective on the fly. In other words, ovn-controller has to be restarted to use that probe_timer value, this patch takes care of that.
This change has been tested putting logs in several places like in ovn-controller.c, lib/rconn.c to make sure the right probe_timer values are in effect. Signed-off-by: Nirapada Ghosh <ngh...@us.ibm.com> --- ovn/controller/ovn-controller.c | 57 +++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/ovn/controller/ovn-controller.c b/ovn/controller/ovn-controller.c index 511b184..f6428ca 100644 --- a/ovn/controller/ovn-controller.c +++ b/ovn/controller/ovn-controller.c @@ -58,7 +58,10 @@ static unixctl_cb_func ovn_controller_exit; static unixctl_cb_func ct_zone_list; #define DEFAULT_BRIDGE_NAME "br-int" +#define DEFAULT_PROBE_INTERVAL_MSEC 5000 +static void update_probe_interval(const struct ovsrec_open_vswitch *cfg, + const struct ovsdb_idl *sb_idl); static void parse_options(int argc, char *argv[]); OVS_NO_RETURN static void usage(void); @@ -226,32 +229,6 @@ get_ovnsb_remote(struct ovsdb_idl *ovs_idl) } } -/* Retrieves the OVN Southbound remote's json session probe interval from the - * "external-ids:ovn-remote-probe-interval" key in 'ovs_idl' and returns it. - * - * This function must be called after get_ovnsb_remote(). */ -static bool -get_ovnsb_remote_probe_interval(struct ovsdb_idl *ovs_idl, int *value) -{ - const struct ovsrec_open_vswitch *cfg = ovsrec_open_vswitch_first(ovs_idl); - if (!cfg) { - return false; - } - - const char *probe_interval = - smap_get(&cfg->external_ids, "ovn-remote-probe-interval"); - if (probe_interval) { - if (str_to_int(probe_interval, 10, value)) { - return true; - } - - VLOG_WARN("Invalid value for OVN remote probe interval: %s", - probe_interval); - } - - return false; -} - int main(int argc, char *argv[]) { @@ -315,10 +292,12 @@ main(int argc, char *argv[]) ovsdb_idl_create(ovnsb_remote, &sbrec_idl_class, true, true)); ovsdb_idl_get_initial_snapshot(ovnsb_idl_loop.idl); - int probe_interval = 0; - if (get_ovnsb_remote_probe_interval(ovs_idl_loop.idl, &probe_interval)) { - ovsdb_idl_set_probe_interval(ovnsb_idl_loop.idl, probe_interval); - } + const struct ovsrec_open_vswitch *cfg = + ovsrec_open_vswitch_first(ovs_idl_loop.idl); + if (!cfg) { + return false; + } + update_probe_interval(cfg, ovnsb_idl_loop.idl); /* Initialize connection tracking zones. */ struct simap ct_zones = SIMAP_INITIALIZER(&ct_zones); @@ -347,6 +326,7 @@ main(int argc, char *argv[]) .ovnsb_idl = ovnsb_idl_loop.idl, .ovnsb_idl_txn = ovsdb_idl_loop_run(&ovnsb_idl_loop), }; + update_probe_interval(cfg, ovnsb_idl_loop.idl); /* Contains "struct local_datpath" nodes whose hash values are the * tunnel_key of datapaths with at least one local port binding. */ @@ -581,3 +561,20 @@ ct_zone_list(struct unixctl_conn *conn, int argc OVS_UNUSED, unixctl_command_reply(conn, ds_cstr(&ds)); ds_destroy(&ds); } + +/* This function will set the SB probe timer value for the session. + * Arguments: + * 'cfg': Holding the external-id values read from southbound DB. + * 'sb_idl': pointer to the ovs_idl connection to OVN southbound. + */ +static void +update_probe_interval(const struct ovsrec_open_vswitch *cfg, + const struct ovsdb_idl *sb_idl) +{ + int interval = smap_get_int(&cfg->external_ids, + "ovn-remote-probe-interval", 0); + ovsdb_idl_set_probe_interval(sb_idl, (interval >= 0 + ? interval + : DEFAULT_PROBE_INTERVAL_MSEC)); +} + -- 1.8.3.1 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev