bbaaef
From b58d7ac109938ceb88ff4d7197a94c6c2af38c63 Mon Sep 17 00:00:00 2001
bbaaef
From: Numan Siddique <numans@ovn.org>
bbaaef
Date: Mon, 17 Feb 2020 11:23:45 +0530
bbaaef
Subject: [PATCH] ovn-ctl: Provide the option to configure inactive probe from
bbaaef
 standby to active.
bbaaef
bbaaef
Recently ovsdb-server supported an unixctl command -
bbaaef
ovsdb-server/set-active-ovsdb-server-probe-interval to configure inactive probe
bbaaef
interval from standby connection to the active. This patch provides the
bbaaef
option to configure this from ovn-ctl and the pacemaker OVN OCF script.
bbaaef
bbaaef
Signed-off-by: Numan Siddique <numans@ovn.org>
bbaaef
Acked-by: Han Zhou <hzhou@ovn.org>
bbaaef
bbaaef
(cherry-picked from upstream OVN repo commit 9991e91e7d592cef533b57af4405405ed5b41866)
bbaaef
Conflicts:
bbaaef
	ovn/utilities/ovn-ctl
bbaaef
bbaaef
Change-Id: I83a8f6e8d86836ed31946efc4aad5c07027f6d08
bbaaef
---
bbaaef
 ovn/utilities/ovn-ctl           |  6 ++++++
bbaaef
 ovn/utilities/ovn-ctl.8.xml     |  8 ++++++--
bbaaef
 ovn/utilities/ovndb-servers.ocf | 23 +++++++++++++++++++----
bbaaef
 3 files changed, 31 insertions(+), 6 deletions(-)
bbaaef
bbaaef
diff --git a/ovn/utilities/ovn-ctl b/ovn/utilities/ovn-ctl
bbaaef
index 65f03e28d..e2c5e5b0e 100755
bbaaef
--- a/ovn/utilities/ovn-ctl
bbaaef
+++ b/ovn/utilities/ovn-ctl
bbaaef
@@ -63,6 +63,7 @@ demote_ovnnb() {
bbaaef
     if test -e $ovnnb_active_conf_file; then
bbaaef
         ovs-appctl -t $OVN_RUNDIR/ovnnb_db.ctl ovsdb-server/set-active-ovsdb-server `cat $ovnnb_active_conf_file`
bbaaef
         ovs-appctl -t $OVN_RUNDIR/ovnnb_db.ctl ovsdb-server/connect-active-ovsdb-server
bbaaef
+        ovs-appctl -t $OVN_RUNDIR/ovnnb_db.ctl ovsdb-server/set-active-ovsdb-server-probe-interval $DB_NB_PROBE_INTERVAL_TO_ACTIVE
bbaaef
     else
bbaaef
         echo >&2 "$0: active server details not set"
bbaaef
         exit 1
bbaaef
@@ -77,6 +78,7 @@ demote_ovnsb() {
bbaaef
     if test -e $ovnsb_active_conf_file; then
bbaaef
         ovs-appctl -t $OVN_RUNDIR/ovnsb_db.ctl ovsdb-server/set-active-ovsdb-server `cat $ovnsb_active_conf_file`
bbaaef
         ovs-appctl -t $OVN_RUNDIR/ovnsb_db.ctl ovsdb-server/connect-active-ovsdb-server
bbaaef
+        ovs-appctl -t $OVN_RUNDIR/ovnsb_db.ctl ovsdb-server/set-active-ovsdb-server-probe-interval $DB_SB_PROBE_INTERVAL_TO_ACTIVE
bbaaef
     else
bbaaef
         echo >&2 "$0: active server details not set"
bbaaef
         exit 1
bbaaef
@@ -454,6 +456,7 @@ set_defaults () {
bbaaef
     DB_NB_SYNC_FROM_PROTO=tcp
bbaaef
     DB_NB_SYNC_FROM_ADDR=
bbaaef
     DB_NB_SYNC_FROM_PORT=6641
bbaaef
+    DB_NB_PROBE_INTERVAL_TO_ACTIVE=60000
bbaaef
 
bbaaef
     DB_SB_SOCK=$OVN_RUNDIR/ovnsb_db.sock
bbaaef
     DB_SB_PID=$OVN_RUNDIR/ovnsb_db.pid
bbaaef
@@ -463,6 +466,7 @@ set_defaults () {
bbaaef
     DB_SB_SYNC_FROM_PROTO=tcp
bbaaef
     DB_SB_SYNC_FROM_ADDR=
bbaaef
     DB_SB_SYNC_FROM_PORT=6642
bbaaef
+    DB_SB_PROBE_INTERVAL_TO_ACTIVE=60000
bbaaef
 
bbaaef
     DB_NB_SCHEMA=$datadir/ovn-nb.ovsschema
bbaaef
     DB_SB_SCHEMA=$datadir/ovn-sb.ovsschema
bbaaef
@@ -628,10 +632,12 @@ File location options:
bbaaef
   --db-nb-sync-from-port=PORT OVN Northbound active db tcp port (default: $DB_NB_SYNC_FROM_PORT)
bbaaef
   --db-nb-sync-from-proto=PROTO OVN Northbound active db transport (default: $DB_NB_SYNC_FROM_PROTO)
bbaaef
   --db-nb-create-insecure-remote=yes|no Create ptcp OVN Northbound remote (default: $DB_NB_CREATE_INSECURE_REMOTE)
bbaaef
+  --db-nb-probe-interval-to-active Active probe interval from standby to active ovsdb-server remote (default: $DB_NB_PROBE_INTERVAL_TO_ACTIVE)
bbaaef
   --db-sb-sync-from-addr=ADDR OVN Southbound active db tcp address (default: $DB_SB_SYNC_FROM_ADDR)
bbaaef
   --db-sb-sync-from-port=ADDR OVN Southbound active db tcp port (default: $DB_SB_SYNC_FROM_PORT)
bbaaef
   --db-sb-sync-from-proto=PROTO OVN Southbound active db transport (default: $DB_SB_SYNC_FROM_PROTO)
bbaaef
   --db-sb-create-insecure-remote=yes|no Create ptcp OVN Southbound remote (default: $DB_SB_CREATE_INSECURE_REMOTE)
bbaaef
+  --db-sb-probe-interval-to-active Active probe interval from standby to active ovsdb-server remote (default: $DB_SB_PROBE_INTERVAL_TO_ACTIVE)
bbaaef
   --db-nb-cluster-local-addr=ADDR OVN_Northbound cluster local address \
bbaaef
   (default: $DB_NB_CLUSTER_LOCAL_ADDR)
bbaaef
   --db-nb-cluster-local-port=PORT OVN_Northbound cluster local tcp port \
bbaaef
diff --git a/ovn/utilities/ovn-ctl.8.xml b/ovn/utilities/ovn-ctl.8.xml
bbaaef
index c5294d794..f0b3d6c87 100644
bbaaef
--- a/ovn/utilities/ovn-ctl.8.xml
bbaaef
+++ b/ovn/utilities/ovn-ctl.8.xml
bbaaef
@@ -94,6 +94,10 @@
bbaaef
     

--db-sb-cluster-remote-port=PORT NUMBER

bbaaef
     

--db-sb-cluster-remote-proto=PROTO (tcp/ssl)

bbaaef
 
bbaaef
+    

Probe interval options

bbaaef
+    

--db-nb-probe-interval-to-active=Time in milliseconds

bbaaef
+    

--db-sb-probe-interval-to-active=Time in milliseconds

bbaaef
+
bbaaef
     

Configuration files

bbaaef
     

Following are the optional configuration files. If present, it should be located in the etc dir

bbaaef
 
bbaaef
@@ -150,8 +154,8 @@
bbaaef
     

Promote and demote ovsdb servers

bbaaef
     

# ovn-ctl promote_ovnnb

bbaaef
     

# ovn-ctl promote_ovnsb

bbaaef
-    

# ovn-ctl --db-nb-sync-from-addr=x.x.x.x --db-nb-sync-from-port=6641 demote_ovnnb

bbaaef
-    

# ovn-ctl --db-sb-sync-from-addr=x.x.x.x --db-sb-sync-from-port=6642 demote_ovnsb

bbaaef
+    

# ovn-ctl --db-nb-sync-from-addr=x.x.x.x --db-nb-sync-from-port=6641 --db-nb-probe-interval-to-active=60000 demote_ovnnb

bbaaef
+    

# ovn-ctl --db-sb-sync-from-addr=x.x.x.x --db-sb-sync-from-port=6642 --db-sb-probe-interval-to-active=60000 demote_ovnsb

bbaaef
 
bbaaef
     

Creating a clustered db on 3 nodes with IPs x.x.x.x, y.y.y.y and z.z.z.z

bbaaef
     

Starting OVN ovsdb servers and ovn-northd on the node with IP x.x.x.x

bbaaef
diff --git a/ovn/utilities/ovndb-servers.ocf b/ovn/utilities/ovndb-servers.ocf
bbaaef
index cd4742668..1737b192e 100755
bbaaef
--- a/ovn/utilities/ovndb-servers.ocf
bbaaef
+++ b/ovn/utilities/ovndb-servers.ocf
bbaaef
@@ -9,6 +9,7 @@
bbaaef
 : ${SB_MASTER_PROTO_DEFAULT="tcp"}
bbaaef
 : ${MANAGE_NORTHD_DEFAULT="no"}
bbaaef
 : ${INACTIVE_PROBE_DEFAULT="5000"}
bbaaef
+: ${INACTIVE_PROBE_TO_MASTER_DEFAULT="60000"}
bbaaef
 : ${LISTEN_ON_MASTER_IP_ONLY_DEFAULT="yes"}
bbaaef
 : ${NB_SSL_KEY_DEFAULT="/etc/openvswitch/ovnnb-privkey.pem"}
bbaaef
 : ${NB_SSL_CERT_DEFAULT="/etc/openvswitch/ovnnb-cert.pem"}
bbaaef
@@ -27,6 +28,7 @@ SB_MASTER_PORT=${OCF_RESKEY_sb_master_port:-${SB_MASTER_PORT_DEFAULT}}
bbaaef
 SB_MASTER_PROTO=${OCF_RESKEY_sb_master_protocol:-${SB_MASTER_PROTO_DEFAULT}}
bbaaef
 MANAGE_NORTHD=${OCF_RESKEY_manage_northd:-${MANAGE_NORTHD_DEFAULT}}
bbaaef
 INACTIVE_PROBE=${OCF_RESKEY_inactive_probe_interval:-${INACTIVE_PROBE_DEFAULT}}
bbaaef
+INACTIVE_PROBE_TO_MASTER=${OCF_RESKEY_inactive_probe_interval_to_master:-${INACTIVE_PROBE_TO_MASTER_DEFAULT}}
bbaaef
 NB_PRIVKEY=${OCF_RESKEY_ovn_nb_db_privkey:-${NB_SSL_KEY_DEFAULT}}
bbaaef
 NB_CERT=${OCF_RESKEY_ovn_nb_db_cert:-${NB_SSL_CERT_DEFAULT}}
bbaaef
 NB_CACERT=${OCF_RESKEY_ovn_nb_db_cacert:-${NB_SSL_CACERT_DEFAULT}}
bbaaef
@@ -135,6 +137,15 @@ ovsdb_server_metadata() {
bbaaef
   <content type="string" />
bbaaef
   </parameter>
bbaaef
 
bbaaef
+  <parameter name="inactive_probe_interval_to_master" unique="1">
bbaaef
+  <longdesc lang="en">
bbaaef
+  Inactive probe interval to use for the connection from standby
bbaaef
+  ovsdb-server to master ovsdb-server.
bbaaef
+  </longdesc>
bbaaef
+  <shortdesc lang="en">Set inactive probe interval to master</shortdesc>
bbaaef
+  <content type="string" />
bbaaef
+  </parameter>
bbaaef
+
bbaaef
   <parameter name="listen_on_master_ip_only" unique="1">
bbaaef
   <longdesc lang="en">
bbaaef
   If set to yes, the OVNDBs will listen on master IP. Otherwise, it will
bbaaef
@@ -266,10 +277,12 @@ inactivity_probe=$INACTIVE_PROBE -- set SB_Global . connections=@conn_uuid
bbaaef
         ocf_log debug "ovndb_server: Connecting to the new master ${OCF_RESKEY_CRM_meta_notify_promote_uname}"
bbaaef
         ${OVN_CTL} demote_ovnnb --db-nb-sync-from-addr=${MASTER_IP} \
bbaaef
                                 --db-nb-sync-from-port=${NB_MASTER_PORT} \
bbaaef
-                                --db-nb-sync-from-proto=${NB_MASTER_PROTO}
bbaaef
+                                --db-nb-sync-from-proto=${NB_MASTER_PROTO} \
bbaaef
+                                --db-nb-probe-interval-to-active=${INACTIVE_PROBE_TO_MASTER}
bbaaef
         ${OVN_CTL} demote_ovnsb --db-sb-sync-from-addr=${MASTER_IP} \
bbaaef
                                 --db-sb-sync-from-port=${SB_MASTER_PORT} \
bbaaef
-                                --db-sb-sync-from-proto=${SB_MASTER_PROTO}
bbaaef
+                                --db-sb-sync-from-proto=${SB_MASTER_PROTO} \
bbaaef
+                                --db-sb-probe-interval-to-active=${INACTIVE_PROBE_TO_MASTER}
bbaaef
     fi
bbaaef
 }
bbaaef
 
bbaaef
@@ -596,10 +609,12 @@ ovsdb_server_demote() {
bbaaef
         # being demoted. Sync to the surviving one
bbaaef
         ${OVN_CTL} demote_ovnnb --db-nb-sync-from-addr=${MASTER_IP} \
bbaaef
                                 --db-nb-sync-from-port=${NB_MASTER_PORT} \
bbaaef
-                                --db-nb-sync-from-proto=${NB_MASTER_PROTO}
bbaaef
+                                --db-nb-sync-from-proto=${NB_MASTER_PROTO} \
bbaaef
+                                --db-nb-probe-interval-to-active=${INACTIVE_PROBE_TO_MASTER}
bbaaef
         ${OVN_CTL} demote_ovnsb --db-sb-sync-from-addr=${MASTER_IP} \
bbaaef
                                 --db-sb-sync-from-port=${SB_MASTER_PORT} \
bbaaef
-                                --db-sb-sync-from-proto=${SB_MASTER_PROTO}
bbaaef
+                                --db-sb-sync-from-proto=${SB_MASTER_PROTO} \
bbaaef
+                                --db-sb-probe-interval-to-active=${INACTIVE_PROBE_TO_MASTER}
bbaaef
 
bbaaef
     else
bbaaef
         # For completeness, should never be called
bbaaef
-- 
bbaaef
2.25.1
bbaaef