diff mbox series

[ovs-dev,ovn] ovn-ctl: Provide the option to configure inactive probe from standby to active.

Message ID 20200217055345.1153487-1-numans@ovn.org
State Accepted
Headers show
Series [ovs-dev,ovn] ovn-ctl: Provide the option to configure inactive probe from standby to active. | expand

Commit Message

Numan Siddique Feb. 17, 2020, 5:53 a.m. UTC
From: Numan Siddique <numans@ovn.org>

Recently ovsdb-server supported an unixctl command -
ovsdb-server/set-active-ovsdb-server-probe-interval to configure inactive probe
interval from standby connection to the active. This patch provides the
option to configure this from ovn-ctl and the pacemaker OVN OCF script.

Signed-off-by: Numan Siddique <numans@ovn.org>
---
 utilities/ovn-ctl           | 14 +++++++++++---
 utilities/ovn-ctl.8.xml     |  8 ++++++--
 utilities/ovndb-servers.ocf | 23 +++++++++++++++++++----
 3 files changed, 36 insertions(+), 9 deletions(-)

Comments

0-day Robot Feb. 17, 2020, 5:56 a.m. UTC | #1
Bleep bloop.  Greetings Numan Siddique, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
WARNING: Line is 121 characters long (recommended limit is 79)
#36 FILE: utilities/ovn-ctl:95:
        ovn-appctl -t $OVN_RUNDIR/$ctl_file ovsdb-server/set-active-ovsdb-server-probe-interval $inactive_probe_to_active

WARNING: Line is 142 characters long (recommended limit is 79)
#77 FILE: utilities/ovn-ctl:932:
  --db-nb-probe-interval-to-active Active probe interval from standby to active ovsdb-server remote (default: $DB_NB_PROBE_INTERVAL_TO_ACTIVE)

WARNING: Line is 142 characters long (recommended limit is 79)
#82 FILE: utilities/ovn-ctl:937:
  --db-sb-probe-interval-to-active Active probe interval from standby to active ovsdb-server remote (default: $DB_SB_PROBE_INTERVAL_TO_ACTIVE)

WARNING: Line is 88 characters long (recommended limit is 79)
#95 FILE: utilities/ovn-ctl.8.xml:154:
    <p><code>--db-nb-probe-interval-to-active=<var>Time in milliseconds</var></code></p>

WARNING: Line is 88 characters long (recommended limit is 79)
#96 FILE: utilities/ovn-ctl.8.xml:155:
    <p><code>--db-sb-probe-interval-to-active=<var>Time in milliseconds</var></code></p>

WARNING: Line is 144 characters long (recommended limit is 79)
#107 FILE: utilities/ovn-ctl.8.xml:248:
    <p><code># 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</code></p>

WARNING: Line is 144 characters long (recommended limit is 79)
#108 FILE: utilities/ovn-ctl.8.xml:249:
    <p><code># 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</code></p>

WARNING: Line is 109 characters long (recommended limit is 79)
#128 FILE: utilities/ovndb-servers.ocf:31:
INACTIVE_PROBE_TO_MASTER=${OCF_RESKEY_inactive_probe_interval_to_master:-${INACTIVE_PROBE_TO_MASTER_DEFAULT}}

WARNING: Line is 92 characters long (recommended limit is 79)
#154 FILE: utilities/ovndb-servers.ocf:281:
                                --db-nb-probe-interval-to-active=${INACTIVE_PROBE_TO_MASTER}

WARNING: Line is 92 characters long (recommended limit is 79)
#159 FILE: utilities/ovndb-servers.ocf:285:
                                --db-sb-probe-interval-to-active=${INACTIVE_PROBE_TO_MASTER}

WARNING: Line is 92 characters long (recommended limit is 79)
#169 FILE: utilities/ovndb-servers.ocf:613:
                                --db-nb-probe-interval-to-active=${INACTIVE_PROBE_TO_MASTER}

WARNING: Line is 92 characters long (recommended limit is 79)
#174 FILE: utilities/ovndb-servers.ocf:617:
                                --db-sb-probe-interval-to-active=${INACTIVE_PROBE_TO_MASTER}

Lines checked: 180, Warnings: 12, Errors: 0


Please check this out.  If you feel there has been an error, please email aconole@redhat.com

Thanks,
0-day Robot
Han Zhou Feb. 18, 2020, 1:42 a.m. UTC | #2
On Sun, Feb 16, 2020 at 9:54 PM <numans@ovn.org> wrote:
>
> From: Numan Siddique <numans@ovn.org>
>
> Recently ovsdb-server supported an unixctl command -
> ovsdb-server/set-active-ovsdb-server-probe-interval to configure inactive
probe
> interval from standby connection to the active. This patch provides the
> option to configure this from ovn-ctl and the pacemaker OVN OCF script.
>
> Signed-off-by: Numan Siddique <numans@ovn.org>

Acked-by: Han Zhou <hzhou@ovn.org>
Numan Siddique Feb. 18, 2020, 6:58 a.m. UTC | #3
On Tue, Feb 18, 2020 at 7:14 AM Han Zhou <hzhou@ovn.org> wrote:
>
> On Sun, Feb 16, 2020 at 9:54 PM <numans@ovn.org> wrote:
> >
> > From: Numan Siddique <numans@ovn.org>
> >
> > Recently ovsdb-server supported an unixctl command -
> > ovsdb-server/set-active-ovsdb-server-probe-interval to configure inactive
> probe
> > interval from standby connection to the active. This patch provides the
> > option to configure this from ovn-ctl and the pacemaker OVN OCF script.
> >
> > Signed-off-by: Numan Siddique <numans@ovn.org>
>
> Acked-by: Han Zhou <hzhou@ovn.org>

Thanks. I applied this to master.

Numan

> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
diff mbox series

Patch

diff --git a/utilities/ovn-ctl b/utilities/ovn-ctl
index c7cb42bc1..2a337ae27 100755
--- a/utilities/ovn-ctl
+++ b/utilities/ovn-ctl
@@ -82,7 +82,8 @@  demote_xx_ovsdb () {
     local sync_from_proto=$2
     local sync_from_port=$3
     local active_conf_file=$4
-    local ctl_file=$5
+    local inactive_probe_to_active=$5
+    local ctl_file=$6
 
     if test ! -z "$sync_from_addr"; then
         echo "$sync_from_proto:$sync_from_addr:$sync_from_port" > $active_conf_file
@@ -91,6 +92,7 @@  demote_xx_ovsdb () {
     if test -e $active_conf_file; then
         ovn-appctl -t $OVN_RUNDIR/$ctl_file ovsdb-server/set-active-ovsdb-server `cat $active_conf_file`
         ovn-appctl -t $OVN_RUNDIR/$ctl_file ovsdb-server/connect-active-ovsdb-server
+        ovn-appctl -t $OVN_RUNDIR/$ctl_file ovsdb-server/set-active-ovsdb-server-probe-interval $inactive_probe_to_active
     else
         echo >&2 "$0: active server details not set"
         exit 1
@@ -99,12 +101,14 @@  demote_xx_ovsdb () {
 
 demote_ovnnb() {
     demote_xx_ovsdb $DB_NB_SYNC_FROM_ADDR $DB_NB_SYNC_FROM_PROTO \
-                    $DB_NB_SYNC_FROM_PORT $ovnnb_active_conf_file ovnnb_db.ctl
+                    $DB_NB_SYNC_FROM_PORT $ovnnb_active_conf_file \
+                    $DB_NB_PROBE_INTERVAL_TO_ACTIVE ovnnb_db.ctl
 }
 
 demote_ovnsb() {
     demote_xx_ovsdb $DB_SB_SYNC_FROM_ADDR $DB_SB_SYNC_FROM_PROTO \
-                    $DB_SB_SYNC_FROM_PORT $ovnsb_active_conf_file ovnsb_db.ctl
+                    $DB_SB_SYNC_FROM_PORT $ovnsb_active_conf_file \
+                    $DB_SB_PROBE_INTERVAL_TO_ACTIVE ovnsb_db.ctl
 }
 
 demote_ic_nb() {
@@ -642,6 +646,7 @@  set_defaults () {
     DB_NB_SYNC_FROM_PROTO=tcp
     DB_NB_SYNC_FROM_ADDR=
     DB_NB_SYNC_FROM_PORT=6641
+    DB_NB_PROBE_INTERVAL_TO_ACTIVE=60000
 
     DB_SB_SOCK=$OVN_RUNDIR/ovnsb_db.sock
     DB_SB_PID=$OVN_RUNDIR/ovnsb_db.pid
@@ -652,6 +657,7 @@  set_defaults () {
     DB_SB_SYNC_FROM_PROTO=tcp
     DB_SB_SYNC_FROM_ADDR=
     DB_SB_SYNC_FROM_PORT=6642
+    DB_SB_PROBE_INTERVAL_TO_ACTIVE=60000
 
     DB_IC_NB_SOCK=$OVN_RUNDIR/ovn_ic_nb_db.sock
     DB_IC_NB_PID=$OVN_RUNDIR/ovn_ic_nb_db.pid
@@ -923,10 +929,12 @@  File location options:
   --db-nb-sync-from-port=PORT OVN Northbound active db tcp port (default: $DB_NB_SYNC_FROM_PORT)
   --db-nb-sync-from-proto=PROTO OVN Northbound active db transport (default: $DB_NB_SYNC_FROM_PROTO)
   --db-nb-create-insecure-remote=yes|no Create ptcp OVN Northbound remote (default: $DB_NB_CREATE_INSECURE_REMOTE)
+  --db-nb-probe-interval-to-active Active probe interval from standby to active ovsdb-server remote (default: $DB_NB_PROBE_INTERVAL_TO_ACTIVE)
   --db-sb-sync-from-addr=ADDR OVN Southbound active db tcp address (default: $DB_SB_SYNC_FROM_ADDR)
   --db-sb-sync-from-port=ADDR OVN Southbound active db tcp port (default: $DB_SB_SYNC_FROM_PORT)
   --db-sb-sync-from-proto=PROTO OVN Southbound active db transport (default: $DB_SB_SYNC_FROM_PROTO)
   --db-sb-create-insecure-remote=yes|no Create ptcp OVN Southbound remote (default: $DB_SB_CREATE_INSECURE_REMOTE)
+  --db-sb-probe-interval-to-active Active probe interval from standby to active ovsdb-server remote (default: $DB_SB_PROBE_INTERVAL_TO_ACTIVE)
   --db-nb-cluster-local-addr=ADDR OVN_Northbound cluster local address \
   (default: $DB_NB_CLUSTER_LOCAL_ADDR)
   --db-nb-cluster-local-port=PORT OVN_Northbound cluster local tcp port \
diff --git a/utilities/ovn-ctl.8.xml b/utilities/ovn-ctl.8.xml
index 816701379..f5b7f7aeb 100644
--- a/utilities/ovn-ctl.8.xml
+++ b/utilities/ovn-ctl.8.xml
@@ -150,6 +150,10 @@ 
     <p><code>--db-ic-sb-cluster-remote-port=<var>PORT NUMBER</var></code></p>
     <p><code>--db-ic-sb-cluster-remote-proto=<var>PROTO (tcp/ssl)</var></code></p>
 
+    <h1> Probe interval options </h1>
+    <p><code>--db-nb-probe-interval-to-active=<var>Time in milliseconds</var></code></p>
+    <p><code>--db-sb-probe-interval-to-active=<var>Time in milliseconds</var></code></p>
+
     <h1>Configuration files</h1>
     <p>Following are the optional configuration files. If present, it should be located in the etc dir</p>
 
@@ -241,8 +245,8 @@ 
     <h2>Promote and demote ovsdb servers</h2>
     <p><code># ovn-ctl promote_ovnnb</code></p>
     <p><code># ovn-ctl promote_ovnsb</code></p>
-    <p><code># ovn-ctl --db-nb-sync-from-addr=x.x.x.x --db-nb-sync-from-port=6641 demote_ovnnb</code></p>
-    <p><code># ovn-ctl --db-sb-sync-from-addr=x.x.x.x --db-sb-sync-from-port=6642 demote_ovnsb</code></p>
+    <p><code># 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</code></p>
+    <p><code># 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</code></p>
 
     <h2>Creating a clustered db on 3 nodes with IPs x.x.x.x, y.y.y.y and z.z.z.z</h2>
     <h3>Starting OVN ovsdb servers and ovn-northd on the node with IP x.x.x.x</h3>
diff --git a/utilities/ovndb-servers.ocf b/utilities/ovndb-servers.ocf
index 42e0412ad..56c2bc322 100755
--- a/utilities/ovndb-servers.ocf
+++ b/utilities/ovndb-servers.ocf
@@ -9,6 +9,7 @@ 
 : ${SB_MASTER_PROTO_DEFAULT="tcp"}
 : ${MANAGE_NORTHD_DEFAULT="no"}
 : ${INACTIVE_PROBE_DEFAULT="5000"}
+: ${INACTIVE_PROBE_TO_MASTER_DEFAULT="60000"}
 : ${LISTEN_ON_MASTER_IP_ONLY_DEFAULT="yes"}
 : ${NB_SSL_KEY_DEFAULT="/etc/openvswitch/ovnnb-privkey.pem"}
 : ${NB_SSL_CERT_DEFAULT="/etc/openvswitch/ovnnb-cert.pem"}
@@ -27,6 +28,7 @@  SB_MASTER_PORT=${OCF_RESKEY_sb_master_port:-${SB_MASTER_PORT_DEFAULT}}
 SB_MASTER_PROTO=${OCF_RESKEY_sb_master_protocol:-${SB_MASTER_PROTO_DEFAULT}}
 MANAGE_NORTHD=${OCF_RESKEY_manage_northd:-${MANAGE_NORTHD_DEFAULT}}
 INACTIVE_PROBE=${OCF_RESKEY_inactive_probe_interval:-${INACTIVE_PROBE_DEFAULT}}
+INACTIVE_PROBE_TO_MASTER=${OCF_RESKEY_inactive_probe_interval_to_master:-${INACTIVE_PROBE_TO_MASTER_DEFAULT}}
 NB_PRIVKEY=${OCF_RESKEY_ovn_nb_db_privkey:-${NB_SSL_KEY_DEFAULT}}
 NB_CERT=${OCF_RESKEY_ovn_nb_db_cert:-${NB_SSL_CERT_DEFAULT}}
 NB_CACERT=${OCF_RESKEY_ovn_nb_db_cacert:-${NB_SSL_CACERT_DEFAULT}}
@@ -135,6 +137,15 @@  ovsdb_server_metadata() {
   <content type="string" />
   </parameter>
 
+  <parameter name="inactive_probe_interval_to_master" unique="1">
+  <longdesc lang="en">
+  Inactive probe interval to use for the connection from standby
+  ovsdb-server to master ovsdb-server.
+  </longdesc>
+  <shortdesc lang="en">Set inactive probe interval to master</shortdesc>
+  <content type="string" />
+  </parameter>
+
   <parameter name="listen_on_master_ip_only" unique="1">
   <longdesc lang="en">
   If set to yes, the OVNDBs will listen on master IP. Otherwise, it will
@@ -266,10 +277,12 @@  inactivity_probe=$INACTIVE_PROBE -- set SB_Global . connections=@conn_uuid
         ocf_log debug "ovndb_server: Connecting to the new master ${OCF_RESKEY_CRM_meta_notify_promote_uname}"
         ${OVN_CTL} demote_ovnnb --db-nb-sync-from-addr=${MASTER_IP} \
                                 --db-nb-sync-from-port=${NB_MASTER_PORT} \
-                                --db-nb-sync-from-proto=${NB_MASTER_PROTO}
+                                --db-nb-sync-from-proto=${NB_MASTER_PROTO} \
+                                --db-nb-probe-interval-to-active=${INACTIVE_PROBE_TO_MASTER}
         ${OVN_CTL} demote_ovnsb --db-sb-sync-from-addr=${MASTER_IP} \
                                 --db-sb-sync-from-port=${SB_MASTER_PORT} \
-                                --db-sb-sync-from-proto=${SB_MASTER_PROTO}
+                                --db-sb-sync-from-proto=${SB_MASTER_PROTO} \
+                                --db-sb-probe-interval-to-active=${INACTIVE_PROBE_TO_MASTER}
     fi
 }
 
@@ -596,10 +609,12 @@  ovsdb_server_demote() {
         # being demoted. Sync to the surviving one
         ${OVN_CTL} demote_ovnnb --db-nb-sync-from-addr=${MASTER_IP} \
                                 --db-nb-sync-from-port=${NB_MASTER_PORT} \
-                                --db-nb-sync-from-proto=${NB_MASTER_PROTO}
+                                --db-nb-sync-from-proto=${NB_MASTER_PROTO} \
+                                --db-nb-probe-interval-to-active=${INACTIVE_PROBE_TO_MASTER}
         ${OVN_CTL} demote_ovnsb --db-sb-sync-from-addr=${MASTER_IP} \
                                 --db-sb-sync-from-port=${SB_MASTER_PORT} \
-                                --db-sb-sync-from-proto=${SB_MASTER_PROTO}
+                                --db-sb-sync-from-proto=${SB_MASTER_PROTO} \
+                                --db-sb-probe-interval-to-active=${INACTIVE_PROBE_TO_MASTER}
 
     else
         # For completeness, should never be called