Skip to content

Commit

Permalink
ovn-ctl: Support for --config-file ovsdb-server option.
Browse files Browse the repository at this point in the history
Since OVS 3.3.0 ovsdb-server accepts databases and remotes configuration
via JSON text file.  This patch adds support for such option.

Signed-off-by: Vladislav Odintsov <odivlad@gmail.com>
Acked-by: Ales Musil <amusil@redhat.com>
Signed-off-by: Numan Siddique <numans@ovn.org>
  • Loading branch information
odivlad authored and numansiddique committed May 15, 2024
1 parent 7f1218a commit 12412b1
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 4 deletions.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Post v24.03.0
- A new LSP option "force_fdb_lookup" has been added to ensure the additional
MAC addresses configured on the LSP with "unknown", are learnt via the
OVN native FDB.
- Add support for ovsdb-server `--config-file` option in ovn-ctl.

OVN v24.03.0 - 01 Mar 2024
--------------------------
Expand Down
38 changes: 34 additions & 4 deletions utilities/ovn-ctl
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ start_ovsdb__() {
local sync_from_port
local file
local schema
local config_file
local logfile
local log
local sock
Expand Down Expand Up @@ -199,6 +200,7 @@ start_ovsdb__() {
eval sync_from_port=\$DB_${DB}_SYNC_FROM_PORT
eval file=\$DB_${DB}_FILE
eval schema=\$DB_${DB}_SCHEMA
eval config_file=\$DB_${DB}_CONFIG_FILE
eval logfile=\$OVN_${DB}_LOGFILE
eval log=\$OVN_${DB}_LOG
eval sock=\$DB_${DB}_SOCK
Expand Down Expand Up @@ -281,7 +283,12 @@ $cluster_remote_port

set ovsdb-server
set "$@" $log --log-file=$logfile
set "$@" --remote=punix:$sock --pidfile=$db_pid_file
set "$@" --pidfile=$db_pid_file
if test X"$config_file" == X; then
set "$@" --remote=punix:$sock
else
set "$@" --config-file=$config_file
fi
set "$@" --unixctl=$ctrl_sock

[ "$OVN_USER" != "" ] && set "$@" --user "$OVN_USER"
Expand All @@ -297,7 +304,7 @@ $cluster_remote_port
set exec "$@"
fi

if test X"$use_remote_in_db" != Xno; then
if test X"$use_remote_in_db" != Xno && test X"$config_file" == X; then
set "$@" --remote=db:$schema_name,$table_name,connections
fi

Expand Down Expand Up @@ -343,6 +350,11 @@ $cluster_remote_port

local run_ovsdb_in_bg="no"
local process_id=

if test X$config_file = X; then
set "$@" "$file"
fi

if test X$detach = Xno && test $mode = cluster && test -z "$cluster_remote_addr" ; then
# When detach is no (for run_nb_ovsdb/run_sb_ovsdb commands)
# we want to run ovsdb-server in background rather than running it in
Expand All @@ -351,10 +363,10 @@ $cluster_remote_port
# Note: We run only the ovsdb-server in backgroud which created the
# cluster (i.e cluster_remote_addr is not set.).
run_ovsdb_in_bg="yes"
"$@" $file &
"$@" &
process_id=$!
else
start_wrapped_daemon "$wrapper" ovsdb-$db "" "$@" "$file"
start_wrapped_daemon "$wrapper" ovsdb-$db "" "$@"
fi

# Initialize the database if it's NOT joining a cluster.
Expand Down Expand Up @@ -776,6 +788,7 @@ set_defaults () {
DB_NB_SYNC_FROM_PORT=6641
DB_NB_PROBE_INTERVAL_TO_ACTIVE=60000
DB_NB_ELECTION_TIMER=
DB_NB_CONFIG_FILE=

DB_SB_SOCK=$OVN_RUNDIR/ovnsb_db.sock
DB_SB_PIDFILE=$OVN_RUNDIR/ovnsb_db.pid
Expand All @@ -788,6 +801,7 @@ set_defaults () {
DB_SB_SYNC_FROM_PORT=6642
DB_SB_PROBE_INTERVAL_TO_ACTIVE=60000
DB_SB_ELECTION_TIMER=
DB_SB_CONFIG_FILE=

DB_IC_NB_SOCK=$OVN_RUNDIR/ovn_ic_nb_db.sock
DB_IC_NB_PIDFILE=$OVN_RUNDIR/ovn_ic_nb_db.pid
Expand All @@ -798,6 +812,7 @@ set_defaults () {
DB_IC_NB_SYNC_FROM_PROTO=tcp
DB_IC_NB_SYNC_FROM_ADDR=
DB_IC_NB_SYNC_FROM_PORT=6645
DB_IC_NB_CONFIG_FILE=

DB_IC_SB_SOCK=$OVN_RUNDIR/ovn_ic_sb_db.sock
DB_IC_SB_PIDFILE=$OVN_RUNDIR/ovn_ic_sb_db.pid
Expand All @@ -808,6 +823,7 @@ set_defaults () {
DB_IC_SB_SYNC_FROM_PROTO=tcp
DB_IC_SB_SYNC_FROM_ADDR=
DB_IC_SB_SYNC_FROM_PORT=6646
DB_IC_SB_CONFIG_FILE=

DB_NB_SCHEMA=$ovn_datadir/ovn-nb.ovsschema
DB_SB_SCHEMA=$ovn_datadir/ovn-sb.ovsschema
Expand Down Expand Up @@ -951,6 +967,7 @@ set_defaults () {
OVN_SB_RELAY_DB_SSL_CERT=""
OVN_SB_RELAY_DB_SSL_CA_CERT=""
DB_SB_RELAY_USE_REMOTE_IN_DB="yes"
DB_SB_RELAY_CONFIG_FILE=

DB_CLUSTER_SCHEMA_UPGRADE="yes"
}
Expand Down Expand Up @@ -1124,12 +1141,16 @@ File location options:
--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-nb-config-file=FILE OVN_Northbound ovsdb-server configuration file
Mutually exclusive with --db-nb-use-remote-in-db=yes.
--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-sb-config-file=FILE OVN_Southbound ovsdb-server configuration file.
Mutually exclusive with --db-sb-use-remote-in-db=yes.
--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 Expand Up @@ -1157,7 +1178,9 @@ File location options:
--ovn-northd-nb-db=NB DB address(es) (default: $OVN_NORTHD_NB_DB)
--ovn-northd-sb-db=SB DB address(es) (default: $OVN_NORTHD_SB_DB)
--db-nb-use-remote-in-db=yes|no OVN_Northbound db listen on target connection table (default: $DB_NB_USE_REMOTE_IN_DB)
'yes' is mutually exclusive with --db-nb-config-file.
--db-sb-use-remote-in-db=yes|no OVN_Southbound db listen on target connection table (default: $DB_SB_USE_REMOTE_IN_DB)
'yes' is mutually exclusive with --db-sb-config-file.
--db-ic-nb-sock=SOCKET OVN_IC_Northbound db socket (default: $DB_IC_NB_SOCK)
--db-ic-sb-sock=SOCKET OVN_IC_Southbound db socket (default: $DB_IC_SB_SOCK)
--db-ic-nb-file=FILE OVN_IC_Northbound db file (default: $DB_IC_NB_FILE)
Expand Down Expand Up @@ -1209,10 +1232,17 @@ File location options:
--ovn-ic-nb-db=IC NB DB address(es) (default: $OVN_IC_NB_DB)
--ovn-ic-sb-db=IC SB DB address(es) (default: $OVN_IC_SB_DB)
--db-ic-nb-use-remote-in-db=yes|no OVN_IC_Northbound db listen on target connection table (default: $DB_IC_NB_USE_REMOTE_IN_DB)
'yes' is mutually exclusive with --db-ic-nb-config-file.
--db-ic-sb-use-remote-in-db=yes|no OVN_IC_Southbound db listen on target connection table (default: $DB_IC_SB_USE_REMOTE_IN_DB)
'yes' is mutually exclusive with --db-ic-sb-config-file.
--db-ic-nb-config-file=FILE OVN_IC_Northbound ovsdb-server configuration file
Mutually exclusive with --db-ic-nb-use-remote-in-db=yes.
--db-ic-sb-config-file=FILE OVN_IC_Southbound ovsdb-server configuration file
Mutually exclusive with --db-ic-sb-use-remote-in-db=yes.
--db-sb-relay-sock=SOCKET OVN_IC_Northbound db socket (default: $DB_SB_RELAY_SOCK)
--db-sb-relay-pidfile=FILE OVN_Southbound relay db pidfile (default: $DB_SB_RELAY_CTRL_PIDFILE)
--db-sb-relay-ctrl-sock=SOCKET OVN_Southbound relay db control socket (default: $DB_SB_RELAY_CTRL_SOCK)
--db-sb-relay-config-file=FILE OVN_Southbound relay ovsdb-server configuration file.
--ovn-sb-relay-db-ssl-key=KEY OVN_Southbound DB relay SSL private key file
--ovn-sb-relay-db-ssl-cert=CERT OVN_Southbound DB relay SSL certificate file
--ovn-sb-relay-db-ssl-ca-cert=CERT OVN OVN_Southbound DB relay SSL CA certificate file
Expand Down
5 changes: 5 additions & 0 deletions utilities/ovn-ctl.8.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@
<p><code>--db-ic-sb-schema=<var>FILE</var></code></p>
<p><code>--db-ic-sb-create-insecure-remote=<var>yes|no</var></code></p>
<p><code>--db-ic-nb-create-insecure-remote=<var>yes|no</var></code></p>
<p><code>--db-nb-config-file=<var>FILE</var></code></p>
<p><code>--db-sb-config-file=<var>FILE</var></code></p>
<p><code>--db-ic-nb-config-file=<var>FILE</var></code></p>
<p><code>--db-ic-sb-config-file=<var>FILE</var></code></p>
<p><code>--db-sb-relay-config-file=<var>FILE</var></code></p>
<p><code>--ovn-controller-ssl-key=<var>KEY</var></code></p>
<p><code>--ovn-controller-ssl-cert=<var>CERT</var></code></p>
<p><code>--ovn-controller-ssl-ca-cert=<var>CERT</var></code></p>
Expand Down

0 comments on commit 12412b1

Please sign in to comment.