diff mbox series

[ovs-dev,2/6] ic: add support to configure ovsdb inactivity probe

Message ID 20230318235031.3793301-3-odivlad@gmail.com
State Accepted
Headers show
Series Inactivity probe configuration for ic, controller-vtep | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_ovn-kubernetes success github build: passed

Commit Message

Vladislav Odintsov March 18, 2023, 11:50 p.m. UTC
IDL to local AZ DBs (OVN_Northbound, OVN_Southbound) should be configured
in NB DB, table NB_Global, column options:ic_probe_interval.

IDL to global DBs (OVN_IC_Northbound, OVN_IC_Southbound) should be
configured in IC NB DB, table IC_NB_Global, column
options:ic_probe_interval.

Signed-off-by: Vladislav Odintsov <odivlad@gmail.com>
---
 ic/ovn-ic.c   | 28 ++++++++++++++++++++++++++++
 ovn-ic-nb.xml | 14 ++++++++++++++
 ovn-nb.xml    | 13 +++++++++++++
 3 files changed, 55 insertions(+)
diff mbox series

Patch

diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c
index 1d0a062f6..feb100859 100644
--- a/ic/ovn-ic.c
+++ b/ic/ovn-ic.c
@@ -35,6 +35,7 @@ 
 #include "lib/ovn-util.h"
 #include "memory.h"
 #include "openvswitch/poll-loop.h"
+#include "ovsdb-idl.h"
 #include "simap.h"
 #include "smap.h"
 #include "sset.h"
@@ -1871,6 +1872,31 @@  update_ssl_config(void)
     }
 }
 
+static void
+update_idl_probe_interval(struct ovsdb_idl *ovn_sb_idl,
+                          struct ovsdb_idl *ovn_nb_idl,
+                          struct ovsdb_idl *ovn_icsb_idl,
+                          struct ovsdb_idl *ovn_icnb_idl)
+{
+    const struct nbrec_nb_global *nb = nbrec_nb_global_first(ovn_nb_idl);
+    int interval = -1;
+    if (nb) {
+        interval = smap_get_int(&nb->options, "ic_probe_interval", interval);
+    }
+    set_idl_probe_interval(ovn_sb_idl, ovnsb_db, interval);
+    set_idl_probe_interval(ovn_nb_idl, ovnnb_db, interval);
+
+    const struct icnbrec_ic_nb_global *icnb =
+        icnbrec_ic_nb_global_first(ovn_icnb_idl);
+    int ic_interval = -1;
+    if (icnb) {
+        ic_interval = smap_get_int(&icnb->options, "ic_probe_interval",
+                                   ic_interval);
+    }
+    set_idl_probe_interval(ovn_icsb_idl, ovn_ic_sb_db, ic_interval);
+    set_idl_probe_interval(ovn_icnb_idl, ovn_ic_nb_db, ic_interval);
+}
+
 int
 main(int argc, char *argv[])
 {
@@ -2071,6 +2097,8 @@  main(int argc, char *argv[])
     state.paused = false;
     while (!exiting) {
         update_ssl_config();
+        update_idl_probe_interval(ovnsb_idl_loop.idl, ovnnb_idl_loop.idl,
+                                  ovnisb_idl_loop.idl, ovninb_idl_loop.idl);
         memory_run();
         if (memory_should_report()) {
             struct simap usage = SIMAP_INITIALIZER(&usage);
diff --git a/ovn-ic-nb.xml b/ovn-ic-nb.xml
index a693611c3..8c53bec3b 100644
--- a/ovn-ic-nb.xml
+++ b/ovn-ic-nb.xml
@@ -47,6 +47,20 @@ 
         This column provides general key/value settings. The supported
         options are described individually below.
       </column>
+
+      <column name="options" key="ic_probe_interval">
+        <p>
+          The inactivity probe interval of the connection to the OVN IC
+          Northbound and Southbound databases from <code>ovn-ic</code>, in
+          milliseconds.  If the value is zero, it disables the connection
+          keepalive feature.
+        </p>
+
+        <p>
+          If the value is nonzero, then it will be forced to a value of
+          at least 1000 ms.
+        </p>
+      </column>
     </group>
 
     <group title="Connection Options">
diff --git a/ovn-nb.xml b/ovn-nb.xml
index 73f707aa0..fd32070f2 100644
--- a/ovn-nb.xml
+++ b/ovn-nb.xml
@@ -202,6 +202,19 @@ 
         </p>
       </column>
 
+      <column name="options" key="ic_probe_interval">
+        <p>
+          The inactivity probe interval of the connection to the OVN Northbound
+          and Southbound databases from <code>ovn-ic</code>, in milliseconds.
+          If the value is zero, it disables the connection keepalive feature.
+        </p>
+
+        <p>
+          If the value is nonzero, then it will be forced to a value of
+          at least 1000 ms.
+        </p>
+      </column>
+
       <column name="options" key="northd_trim_timeout">
         <p>
           When used, this configuration value specifies the time, in