Default is yes (current behavior).  This means that after start process
will be run in background.  When "no" is given, process is run in
foreground with `exec` call, which replaces current process (ovs-ctl) with
wanted ovs process (ovsdb-server or ovs-vswitchd).

This option is useful when running ovs-ctl inside docker container to make
ovs* process to be a pid 1.

Note, that with `--detach=no` database settings initialization is not done.
db-version, system-ids are not set and transient ports are not deleted.

Signed-off-by: Vladislav Odintsov <[email protected]>
---
 utilities/ovs-ctl.in | 5 +++++
 utilities/ovs-lib.in | 8 +++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
index 0b2820c36..72c8881e3 100644
--- a/utilities/ovs-ctl.in
+++ b/utilities/ovs-ctl.in
@@ -338,6 +338,7 @@ set_defaults () {
     DUMP_HUGEPAGES=no
     MLOCKALL=yes
     SELF_CONFINEMENT=yes
+    DETACH=yes
     MONITOR=yes
     OVS_USER=
     OVSDB_SERVER=yes
@@ -442,6 +443,10 @@ Less important options for "start", "restart" and 
"force-reload-kmod":
   --no-full-hostname             set short hostname instead of full hostname
   --no-record-hostname           do not attempt to determine/record system
                                  hostname as part of start command
+  --detach=yes|no                Run process in background (default: $DETACH).
+                                 If "no", replace current process with "exec".
+                                 Note, that with "no" database settings 
initialization is not done.
+                                 db-version, system-ids are not set and 
transient ports are not deleted.
 
 Debugging options for "start", "restart" and "force-reload-kmod":
   --ovsdb-server-wrapper=WRAPPER
diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in
index 7812a94ee..9db700e6a 100644
--- a/utilities/ovs-lib.in
+++ b/utilities/ovs-lib.in
@@ -183,7 +183,13 @@ start_daemon () {
     # pidfile and monitoring
     install_dir "$rundir"
     set "$@" --pidfile="$rundir/$daemon.pid"
-    set "$@" --detach
+
+    if test X"$DETACH" != Xno; then
+        set "$@" --detach
+    else
+        set exec "$@"
+    fi
+
     test X"$MONITOR" = Xno || set "$@" --monitor
 
     # wrapper
-- 
2.36.1

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

Reply via email to