diff options
author | Numan Siddique <nusiddiq@redhat.com> | 2017-12-01 14:37:38 +0530 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2017-12-01 08:56:26 -0800 |
commit | 74103dc2860e87208b510bf80117115a0e36af29 (patch) | |
tree | ab2189562bd5e1806e8796d5997211ee3145772a /ovn | |
parent | 0884990e65dd1574eaaf75bc33b9e0c6581f5315 (diff) | |
download | openvswitch-74103dc2860e87208b510bf80117115a0e36af29.tar.gz |
ovn-ctl: Add new commands 'run_nb_server' and 'run_sb_server'
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 <blp@ovn.org>
Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'ovn')
-rwxr-xr-x | ovn/utilities/ovn-ctl | 35 | ||||
-rw-r--r-- | ovn/utilities/ovn-ctl.8.xml | 26 |
2 files changed, 58 insertions, 3 deletions
diff --git a/ovn/utilities/ovn-ctl b/ovn/utilities/ovn-ctl index 4cfe59b5b..0e56bf8c5 100755 --- a/ovn/utilities/ovn-ctl +++ b/ovn/utilities/ovn-ctl @@ -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 @@ -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 @@ -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> |