Skip to content

Commit

Permalink
ovn-ctl: add RAFT election timer argument and pass to ovsdb-tool
Browse files Browse the repository at this point in the history
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: #109
Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: Numan Siddique <numans@ovn.org>
  • Loading branch information
dcbw authored and numansiddique committed Dec 16, 2021
1 parent b38c5ae commit a1b6568
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion utilities/ovn-ctl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -212,14 +214,23 @@ $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:\
$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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 \
Expand Down

0 comments on commit a1b6568

Please sign in to comment.