From a4927e36ff8fa079338374c61dcae60c5efcff54 Mon Sep 17 00:00:00 2001
From: Huang Lei
external_ids:ovn-remote-probe-interval
+ The inactivity probe interval of the connection to the OVN database, + in milliseconds. + If the value is zero, it disables the connection keepalive feature. +
+ ++ If the value is nonzero, then it will be forced to a value of + at least 1000 ms. +
+external_ids:ovn-encap-type
diff --git a/ovn/controller/ovn-controller.c b/ovn/controller/ovn-controller.c index 44ab8b323..6027011dd 100644 --- a/ovn/controller/ovn-controller.c +++ b/ovn/controller/ovn-controller.c @@ -198,6 +198,32 @@ 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[]) { @@ -261,6 +287,11 @@ 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); + } + /* Initialize connection tracking zones. */ struct simap ct_zones = SIMAP_INITIALIZER(&ct_zones); unsigned long ct_zone_bitmap[BITMAP_N_LONGS(MAX_CT_ZONES)]; -- 2.39.5