diff mbox

[ovs-dev,v3] Add monitoring to ovsdb

Message ID 1470933197-15220-1-git-send-email-conner.herriges@ibm.com
State Changes Requested
Headers show

Commit Message

Conner Herriges Aug. 11, 2016, 4:33 p.m. UTC
Monitoring is a valid option on POSIX based platforms. The monitor
creates an additional process to monitor the ovsdb-server daemon. If
the daemon dies due to a programming error, then the monitor process
starts a new copy of it. If the daemon dies or exits for another
reason, the monitor process exits.

The monitor option is not currently enabled for either OVN Northboud or
Southbound databases. It would be a trivial task to enable the monitor
in the start_ovsdb function in ovn-ctl. However,
this is an attempt to do so using the start_daemon function in ovs-lib,
which is currently used by ovn-northd and ovn-controller.

Signed-off-by: Conner Herriges <conner.herriges@ibm.com>

v3 changes: removed spacing errors and change log comments
---
 ovn/utilities/ovn-ctl | 13 ++++++++-----
 utilities/ovs-lib.in  | 28 +++++++++++++++-------------
 2 files changed, 23 insertions(+), 18 deletions(-)

Comments

Ben Pfaff Aug. 11, 2016, 5:45 p.m. UTC | #1
On Thu, Aug 11, 2016 at 11:33:17AM -0500, Conner Herriges wrote:
> Monitoring is a valid option on POSIX based platforms. The monitor
> creates an additional process to monitor the ovsdb-server daemon. If
> the daemon dies due to a programming error, then the monitor process
> starts a new copy of it. If the daemon dies or exits for another
> reason, the monitor process exits.
> 
> The monitor option is not currently enabled for either OVN Northboud or
> Southbound databases. It would be a trivial task to enable the monitor
> in the start_ovsdb function in ovn-ctl. However,
> this is an attempt to do so using the start_daemon function in ovs-lib,
> which is currently used by ovn-northd and ovn-controller.
> 
> Signed-off-by: Conner Herriges <conner.herriges@ibm.com>
> 
> v3 changes: removed spacing errors and change log comments

Still breaks ovs-ctl by disabling start_daemon features.
diff mbox

Patch

diff --git a/ovn/utilities/ovn-ctl b/ovn/utilities/ovn-ctl
index a4a9817..f768649 100755
--- a/ovn/utilities/ovn-ctl
+++ b/ovn/utilities/ovn-ctl
@@ -52,9 +52,8 @@  start_ovsdb () {
 
         set ovsdb-server
 
-        set "$@" --detach $OVN_NB_LOG --log-file=$OVN_NB_LOGFILE --remote=punix:$DB_NB_SOCK --remote=ptcp:$DB_NB_PORT:$DB_NB_ADDR --pidfile=$DB_NB_PID --unixctl=ovnnb_db.ctl
-
-        $@ $DB_NB_FILE
+        set "$@" --detach $OVN_NB_LOG --log-file=$OVN_NB_LOGFILE --remote=punix:$DB_NB_SOCK --remote=ptcp:$DB_NB_PORT:$DB_NB_ADDR --pidfile=$DB_NB_PID --unixctl=ovnnb_db.ctl $DB_NB_FILE
+        OVS_RUNDIR=${OVN_RUNDIR} start_daemon "$OVN_NB_PRIORITY" "$OVN_NB_WRAPPER" "$@"
     fi
 
     # Check and eventually start ovsdb-server for Southbound DB
@@ -63,8 +62,8 @@  start_ovsdb () {
 
         set ovsdb-server
 
-        set "$@" --detach $OVN_SB_LOG --log-file=$OVN_SB_LOGFILE --remote=punix:$DB_SB_SOCK --remote=ptcp:$DB_SB_PORT:$DB_SB_ADDR --pidfile=$DB_SB_PID --unixctl=ovnsb_db.ctl
-        $@ $DB_SB_FILE
+        set "$@" --detach $OVN_SB_LOG --log-file=$OVN_SB_LOGFILE --remote=punix:$DB_SB_SOCK --remote=ptcp:$DB_SB_PORT:$DB_SB_ADDR --pidfile=$DB_SB_PID --unixctl=ovnsb_db.ctl $DB_SB_FILE
+        OVS_RUNDIR=${OVN_RUNDIR} start_daemon "$OVN_SB_PRIORITY" "$OVN_SB_WRAPPER" "$@"
     fi
 }
 
@@ -189,6 +188,10 @@  set_defaults () {
     DB_SOCK=$rundir/db.sock
     DB_CONF_FILE=$dbdir/conf.db
 
+    OVN_NB_PRIORITY=-10
+    OVN_NB_WRAPPER=
+    OVN_SB_PRIORITY=-10
+    OVN_SB_WRAPPER=
     OVN_NORTHD_PRIORITY=-10
     OVN_NORTHD_WRAPPER=
     OVN_CONTROLLER_PRIORITY=-10
diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in
index cbad85a..3514ab0 100644
--- a/utilities/ovs-lib.in
+++ b/utilities/ovs-lib.in
@@ -155,19 +155,21 @@  start_daemon () {
     daemon=$1
     strace=""
 
-    # drop core files in a sensible place
-    test -d "$DAEMON_CWD" || install -d -m 755 -o root -g root "$DAEMON_CWD"
-    set "$@" --no-chdir
-    cd "$DAEMON_CWD"
-
-    # log file
-    test -d "$logdir" || install -d -m 755 -o root -g root "$logdir"
-    set "$@" --log-file="$logdir/$daemon.log"
-
-    # pidfile and monitoring
-    test -d "$rundir" || install -d -m 755 -o root -g root "$rundir"
-    set "$@" --pidfile="$rundir/$daemon.pid"
-    set "$@" --detach
+    if [ "$daemon" != "ovsdb-server" ]; then
+       # drop core files in a sensible place
+        test -d "$DAEMON_CWD" || install -d -m 755 -o root -g root "$DAEMON_CWD"
+        set "$@" --no-chdir
+        cd "$DAEMON_CWD"
+
+        # log file
+        test -d "$logdir" || install -d -m 755 -o root -g root "$logdir"
+        set "$@" --log-file="$logdir/$daemon.log"
+
+        # pidfile and monitoring
+        test -d "$rundir" || install -d -m 755 -o root -g root "$rundir"
+        set "$@" --pidfile="$rundir/$daemon.pid"
+        set "$@" --detach
+    fi
     test X"$MONITOR" = Xno || set "$@" --monitor
 
     # wrapper