diff mbox series

[ovs-dev,4/4] ovn-ctl: add RAFT election timer argument and pass to ovsdb-tool

Message ID 20211216032657.2594118-1-numans@ovn.org
State Accepted
Headers show
Series ovn-ctl: database path fixes and RAFT election timer passthrough | expand

Checks

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

Commit Message

Numan Siddique Dec. 16, 2021, 3:26 a.m. UTC
From: Dan Williams <dcbw@redhat.com>

Exits with an error if ovsdb-tool doesn't support --election-timer
which was added in OVS 2.16 and later.

Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1831778
Submitted-at: https://github.com/ovn-org/ovn/pull/109
Signed-off-by: Dan Williams <dcbw@redhat.com>
---
 utilities/ovn-ctl | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

Comments

0-day Robot Dec. 16, 2021, 3:41 a.m. UTC | #1
Bleep bloop.  Greetings Dan Williams, 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 105 characters long (recommended limit is 79)
#81 FILE: utilities/ovn-ctl:989:
  --db-nb-election-timer=MS OVN Northbound RAFT db election timer to use on db creation (in milliseconds)

WARNING: Line is 105 characters long (recommended limit is 79)
#87 FILE: utilities/ovn-ctl:995:
  --db-sb-election-timer=MS OVN Southbound RAFT db election timer to use on db creation (in milliseconds)

Lines checked: 93, Warnings: 2, Errors: 0


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

Thanks,
0-day Robot
diff mbox series

Patch

diff --git a/utilities/ovn-ctl b/utilities/ovn-ctl
index 45ad197059..b789d57bed 100755
--- a/utilities/ovn-ctl
+++ b/utilities/ovn-ctl
@@ -165,6 +165,7 @@  start_ovsdb__() {
     local ovn_db_ssl_key
     local ovn_db_ssl_cert
     local ovn_db_ssl_cacert
+    local ovn_db_election_timer
     eval db_pid_file=\$DB_${DB}_PIDFILE
     eval cluster_local_addr=\$DB_${DB}_CLUSTER_LOCAL_ADDR
     eval cluster_local_port=\$DB_${DB}_CLUSTER_LOCAL_PORT
@@ -190,6 +191,7 @@  start_ovsdb__() {
     eval ovn_db_ssl_key=\$OVN_${DB}_DB_SSL_KEY
     eval ovn_db_ssl_cert=\$OVN_${DB}_DB_SSL_CERT
     eval ovn_db_ssl_cacert=\$OVN_${DB}_DB_SSL_CA_CERT
+    eval ovn_db_election_timer=\$DB_${DB}_ELECTION_TIMER
 
     ovn_install_dir "$OVN_RUNDIR"
     ovn_install_dir "$ovn_logdir"
@@ -212,6 +214,15 @@  $sync_from_port" > $active_conf_file
     fi
 
     if test $mode = cluster; then
+        # check for election timer arg support in ovsdb-tool
+        has_election_timer=$(ovsdb-tool --help | grep "\--election-timer")
+        if test -n "$ovn_db_election_timer" && \
+            test -z "$has_election_timer"; then
+            # caller requested election timer but ovsdb-tool doesn't support it
+            log_failure_msg "ovsdb-tool does not support --election-timer"
+            exit
+        fi
+
         local local=$cluster_local_proto:$cluster_local_addr:\
 $cluster_local_port
         local remote=$cluster_remote_proto:$cluster_remote_addr:\
@@ -219,7 +230,7 @@  $cluster_remote_port
         if test -n "$cluster_remote_addr"; then
             join_cluster "$file" "$schema_name" "$local" "$remote"
         else
-            create_cluster "$file" "$schema" "$local"
+            create_cluster "$file" "$schema" "$local" "$ovn_db_election_timer"
         fi
     else
         upgrade_db "$file" "$schema"
@@ -672,6 +683,7 @@  set_defaults () {
     DB_NB_SYNC_FROM_ADDR=
     DB_NB_SYNC_FROM_PORT=6641
     DB_NB_PROBE_INTERVAL_TO_ACTIVE=60000
+    DB_NB_ELECTION_TIMER=
 
     DB_SB_SOCK=$OVN_RUNDIR/ovnsb_db.sock
     DB_SB_PIDFILE=$OVN_RUNDIR/ovnsb_db.pid
@@ -683,6 +695,7 @@  set_defaults () {
     DB_SB_SYNC_FROM_ADDR=
     DB_SB_SYNC_FROM_PORT=6642
     DB_SB_PROBE_INTERVAL_TO_ACTIVE=60000
+    DB_SB_ELECTION_TIMER=
 
     DB_IC_NB_SOCK=$OVN_RUNDIR/ovn_ic_nb_db.sock
     DB_IC_NB_PIDFILE=$OVN_RUNDIR/ovn_ic_nb_db.pid
@@ -973,11 +986,13 @@  File location options:
   --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-nb-election-timer=MS OVN Northbound RAFT db election timer to use on db creation (in milliseconds)
   --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-sb-election-timer=MS OVN Southbound RAFT db election timer to use on db creation (in milliseconds)
   --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 \