Skip to content

Commit

Permalink
ovn-ctl: Add new commands 'run_nb_server' and 'run_sb_server'
Browse files Browse the repository at this point in the history
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.

Suggested-by: Ben Pfaff <[email protected]>
Signed-off-by: Numan Siddique <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
numansiddique authored and blp committed Dec 1, 2017
1 parent 0884990 commit 74103dc
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 3 deletions.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Post-v2.8.0
- Added support to generate Neighbor Solicitation packets using the OVN
action 'nd_ns' to resolve unknown next hop MAC addresses for the
IPv6 packets.
* ovn-ctl: New commands run_nb_ovsdb and run_sb_ovsdb.
- Linux kernel 4.13
* Add support for compiling OVS with the latest Linux 4.13 kernel

Expand Down
35 changes: 33 additions & 2 deletions ovn/utilities/ovn-ctl
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ start_nb_ovsdb() {

set ovsdb-server

set "$@" --detach --monitor
if test X"$DB_NB_DETACH" != Xno; then
set "$@" --detach --monitor
else
set exec "$@"
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
Expand Down Expand Up @@ -135,7 +140,12 @@ start_sb_ovsdb() {

set ovsdb-server

set "$@" --detach --monitor
if test X"$DB_SB_DETACH" != Xno; then
set "$@" --detach --monitor
else
set exec "$@"
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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -383,6 +403,9 @@ set_defaults () {
DB_NB_CREATE_INSECURE_REMOTE="no"

MONITOR="yes"

DB_NB_DETACH="yes"
DB_SB_DETACH="yes"
}

set_option () {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
;;
Expand Down
26 changes: 25 additions & 1 deletion ovn/utilities/ovn-ctl.8.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand All @@ -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>

0 comments on commit 74103dc

Please sign in to comment.