[ovs-dev] [PATCH v2] ovn-ctl: Add new commands 'run_nb_server' and 'run_sb_server'
nusiddiq at redhat.com
nusiddiq at redhat.com
Tue Nov 21 07:05:56 UTC 2017
From: Numan Siddique <nusiddiq at redhat.com>
Presently if the user wants to start OVN db servers as separate containers, 'ovn-ctl'
script is not useful as '--detach' option is passed when ovsdb-servers are started.
If the container command is 'ovn-ctl start_nb_ovsdb', the container exits as soon as
ovn-ctl exits.
This patch adds two new commands - 'run_nb_server' and 'run_sb_server'. This will be
really useful for the above mentioned requirement.
Without these commands, the user may have to first generate the db by running 'ovsdb-tool'
and then start the container with the command 'ovsdb-server ovnnb_db.db ....' and this
is very inconvenient.
This patch also updates the documentation in ovn-ctl.8.xml.
Signed-off-by: Numan Siddique <nusiddiq at redhat.com>
---
ovn/utilities/ovn-ctl | 39 +++++++++++++++++++++++++++++++++++----
ovn/utilities/ovn-ctl.8.xml | 26 +++++++++++++++++++++++++-
2 files changed, 60 insertions(+), 5 deletions(-)
diff --git a/ovn/utilities/ovn-ctl b/ovn/utilities/ovn-ctl
index 3e247a1c6..bf99584e6 100755
--- a/ovn/utilities/ovn-ctl
+++ b/ovn/utilities/ovn-ctl
@@ -100,7 +100,9 @@ start_nb_ovsdb() {
set ovsdb-server
- set "$@" --detach --monitor
+ if test X"$DB_NB_DETACH" != Xno; then
+ set "$@" --detach --monitor
+ fi
set "$@" $OVN_NB_LOG --log-file=$OVN_NB_LOGFILE
set "$@" --remote=punix:$DB_NB_SOCK --pidfile=$DB_NB_PID
set "$@" --remote=db:OVN_Northbound,NB_Global,connections
@@ -124,7 +126,10 @@ start_nb_ovsdb() {
fi
$@ $DB_NB_FILE
- ovn-nbctl init
+
+ if test X"$DB_NB_DETACH" != Xno; then
+ ovn-nbctl init
+ fi
fi
}
@@ -135,7 +140,9 @@ start_sb_ovsdb() {
set ovsdb-server
- set "$@" --detach --monitor
+ if test X"$DB_SB_DETACH" != Xno; then
+ set "$@" --detach --monitor
+ fi
set "$@" $OVN_SB_LOG --log-file=$OVN_SB_LOGFILE
set "$@" --remote=punix:$DB_SB_SOCK --pidfile=$DB_SB_PID
set "$@" --remote=db:OVN_Southbound,SB_Global,connections
@@ -159,7 +166,10 @@ start_sb_ovsdb() {
fi
$@ $DB_SB_FILE
- ovn-sbctl init
+
+ if test X"$DB_SB_DETACH" != Xno; then
+ ovn-sbctl init
+ fi
fi
}
@@ -202,6 +212,16 @@ status_ovsdb () {
fi
}
+run_nb_ovsdb() {
+ DB_NB_DETACH=no
+ start_nb_ovsdb
+}
+
+run_sb_ovsdb() {
+ DB_SB_DETACH=no
+ start_sb_ovsdb
+}
+
start_northd () {
if [ ! -e $ovn_northd_db_conf_file ]; then
if test X"$OVN_MANAGE_OVSDB" = Xyes; then
@@ -383,6 +403,9 @@ set_defaults () {
DB_NB_CREATE_INSECURE_REMOTE="no"
MONITOR="yes"
+
+ DB_NB_DETACH="yes"
+ DB_SB_DETACH="yes"
}
set_option () {
@@ -426,6 +449,8 @@ Commands:
restart_sb_ovsdb restart ovn southbound db ovsdb-server process
restart_controller restart ovn-controller
restart_controller_vtep restart ovn-controller-vtep
+ run_nb_ovsdb run ovn northbound db ovsdb-server process
+ run_sb_ovsdb run ovn southbound db ovsdb-server process
Options:
--ovn-northd-priority=NICE set ovn-northd's niceness (default: $OVN_NORTHD_PRIORITY)
@@ -610,6 +635,12 @@ case $command in
status_ovnsb)
status_ovnsb
;;
+ run_nb_ovsdb)
+ run_nb_ovsdb
+ ;;
+ run_sb_ovsdb)
+ run_sb_ovsdb
+ ;;
help)
usage
;;
diff --git a/ovn/utilities/ovn-ctl.8.xml b/ovn/utilities/ovn-ctl.8.xml
index 7b090aee4..40defc9ec 100644
--- a/ovn/utilities/ovn-ctl.8.xml
+++ b/ovn/utilities/ovn-ctl.8.xml
@@ -28,6 +28,15 @@
<dt><code>demote_ovnsb</code></dt>
<dt><code>status_ovnnb</code></dt>
<dt><code>status_ovnsb</code></dt>
+ <dt><code>start_ovsdb</code></dt>
+ <dt><code>start_nb_ovsdb</code></dt>
+ <dt><code>start_sb_ovsdb</code></dt>
+ <dt><code>stop_ovsdb</code></dt>
+ <dt><code>stop_nb_ovsdb</code></dt>
+ <dt><code>stop_sb_ovsdb</code></dt>
+ <dt><code>restart_ovsdb</code></dt>
+ <dt><code>run_nb_ovsdb</code></dt>
+ <dt><code>run_sb_ovsdb</code></dt>
</dl>
<h1>Options</h1>
@@ -83,6 +92,22 @@
</p>
<p><code>--ovnnb-db=tcp:x.x.x.x:6641 --ovnsb-db=tcp:x.x.x.x:6642</code></p>
+ <h1> Running OVN db servers without detaching </h1>
+ <p><code># ovn-ctl run_nb_ovsdb</code></p>
+ <p>
+ This command runs the OVN nb ovsdb-server without passing the
+ <code>detach</code> option, making it to block until ovsdb-server exits.
+ This command will be useful for starting the OVN nb ovsdb-server in a
+ container.
+ </p>
+ <p><code># ovn-ctl run_sb_ovsdb</code></p>
+ <p>
+ This command runs the OVN sb ovsdb-server without passing the
+ <code>detach</code> option, making it to block until ovsdb-server exits.
+ This command will be useful for starting the OVN sb ovsdb-server in a
+ container.
+ </p>
+
<h1>Example Usage</h1>
<h2>Run ovn-controller on a host already running OVS</h2>
<p><code># ovn-ctl start_controller</code></p>
@@ -100,5 +125,4 @@
<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>
-
</manpage>
--
2.14.3
More information about the dev
mailing list