On Tue, Apr 23, 2024 at 6:43 PM Vladislav Odintsov <odiv...@gmail.com> wrote:
> 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 <odiv...@gmail.com> > --- > NEWS | 1 + > utilities/ovn-ctl | 39 +++++++++++++++++++++++++++++++++++---- > 2 files changed, 36 insertions(+), 4 deletions(-) > > diff --git a/NEWS b/NEWS > index 9adf6a31c..39ea88d78 100644 > --- a/NEWS > +++ b/NEWS > @@ -16,6 +16,7 @@ Post v24.03.0 > - Remove "ovn-set-local-ip" config option from vswitchd > external-ids, the option is no longer needed as it became effectively > "true" for all scenarios. > + - Add support for ovsdb-server `--config-file` option in ovn-ctl. > > OVN v24.03.0 - 01 Mar 2024 > -------------------------- > diff --git a/utilities/ovn-ctl b/utilities/ovn-ctl > index dae5e22f4..fd1ae1256 100755 > --- a/utilities/ovn-ctl > +++ b/utilities/ovn-ctl > @@ -169,6 +169,7 @@ start_ovsdb__() { > local sync_from_port > local file > local schema > + local config_file > local logfile > local log > local sock > @@ -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 > @@ -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" > @@ -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 > > @@ -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 > @@ -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. > @@ -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 > @@ -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 > @@ -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 > @@ -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 > @@ -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" > } > @@ -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 \ > @@ -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) > @@ -1209,10 +1232,18 @@ 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_IC_Northbound ovsdb-server > configuration file > + Mutually exclusive with > --db-ic-nb-use-remote-in-db=yes. > --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 > -- > 2.44.0 > > _______________________________________________ > dev mailing list > d...@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev > > Looks good to me, thanks. Acked-by: Ales Musil <amu...@redhat.com> -- Ales Musil Senior Software Engineer - OVN Core Red Hat EMEA <https://www.redhat.com> amu...@redhat.com <https://red.ht/sig> _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev