From: Numan Siddique <[email protected]>

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 2 new options to the 'ovn-ctl' script - '--db-nb-detach' and
'--db-sb-detach' which can take 'yes/no'. This will be really useful for the 
above
mentioned requirement. The user can start NB ovsdb-server with the command
'ovn-ctl start_nb_ovsdb --db-nb-detach=no'.

Without this option, 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 option will be useful only if the OVN db servers are 
started
in separate containers.

This patch also updates the missing documentation in ovn-ctl.8.xml.

Signed-off-by: Numan Siddique <[email protected]>
---
 ovn/utilities/ovn-ctl       | 15 +++++++++++++--
 ovn/utilities/ovn-ctl.8.xml |  9 +++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/ovn/utilities/ovn-ctl b/ovn/utilities/ovn-ctl
index 3e247a1c6..8261b82c7 100755
--- a/ovn/utilities/ovn-ctl
+++ b/ovn/utilities/ovn-ctl
@@ -100,7 +100,10 @@ start_nb_ovsdb() {
 
         set ovsdb-server
 
-        set "$@" --detach --monitor
+        if test X"$DB_NB_DETACH" = Xyes; 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
@@ -135,7 +138,10 @@ start_sb_ovsdb() {
 
         set ovsdb-server
 
-        set "$@" --detach --monitor
+        if test X"$DB_SB_DETACH" = Xyes; 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
@@ -383,6 +389,9 @@ set_defaults () {
     DB_NB_CREATE_INSECURE_REMOTE="no"
 
     MONITOR="yes"
+
+    DB_NB_DETACH="yes"
+    DB_SB_DETACH="yes"
 }
 
 set_option () {
@@ -469,6 +478,8 @@ File location options:
   --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-nb-detach=yes|no OVN_Northbound detach server (default: $DB_NB_DETACH)
+  --db-sb-detach=yes|no OVN_Southbound detach server (default: $DB_SB_DETACH)
 
 Default directories with "configure" option and environment variable override:
   logs: /usr/local/var/log/openvswitch (--with-logdir, OVS_LOGDIR)
diff --git a/ovn/utilities/ovn-ctl.8.xml b/ovn/utilities/ovn-ctl.8.xml
index 7b090aee4..457475c19 100644
--- a/ovn/utilities/ovn-ctl.8.xml
+++ b/ovn/utilities/ovn-ctl.8.xml
@@ -28,6 +28,13 @@
       <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>
     </dl>
 
     <h1>Options</h1>
@@ -35,6 +42,8 @@
     <p><code>--ovn-northd-wrapper=<var>WRAPPER</var></code></p>
     <p><code>--ovn-controller-priority=<var>NICE</var></code></p>
     <p><code>--ovn-controller-wrapper=<var>WRAPPER</var></code></p>
+    <p><code>--db-nb-detach=<var>yes|no</var></code></p>
+    <p><code>--db-sb-detach=<var>yes|no</var></code></p>
     <p><code>-h</code> | <code>--help</code></p>
 
     <h1>File location options</h1>
-- 
2.13.5

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to