From 1060d922a0fee3c9795eb58d5799b235ae406bc6 Mon Sep 17 00:00:00 2001
Message-Id: <1060d922a0fee3c9795eb58d5799b235ae406bc6.1599568836.git.lorenzo.bianconi@redhat.com>
From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Date: Fri, 21 Aug 2020 15:40:13 +0200
Subject: [PATCH] ovn-ctl: introduce ovsdb-{n, s}b-wrapper options
ovn-ctl has the following options to run ovn-northd, ovn-controller or
ovn-ic under strace or valgrind wrappers.
--ovn-northd-wrapper
--ovn-controller-wrapper
--ovn-ic-wrapper
Introduce --ovsdb-nb-wrapper and --ovsdb-sb-wrapper to do the same for
ovsdb processes for ovn-{nb,sb} dbs
Tested-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Acked-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Numan Siddique <numans@ovn.org>
---
utilities/ovn-ctl | 18 ++++++++++-----
utilities/ovn-ctl.8.xml | 2 ++
utilities/ovn-lib.in | 49 ++++++++++++++++++++++++-----------------
3 files changed, 43 insertions(+), 26 deletions(-)
--- a/utilities/ovn-ctl
+++ b/utilities/ovn-ctl
@@ -145,7 +145,7 @@ promote_ic_sb() {
}
start_ovsdb__() {
- local DB=$1 db=$2 schema_name=$3 table_name=$4
+ local DB=$1 db=$2 schema_name=$3 table_name=$4 wrapper=$5
local db_pid_file
local cluster_local_addr
local cluster_local_port
@@ -288,7 +288,7 @@ $cluster_remote_port
set "$@" --sync-from=`cat $active_conf_file`
fi
- "$@" "$file"
+ start_wrapped_daemon "$wrapper" ovsdb-$db "" "$@" "$file"
# Initialize the database if it's NOT joining a cluster.
if test -z "$cluster_remote_addr"; then
@@ -301,7 +301,7 @@ $cluster_remote_port
}
start_nb_ovsdb() {
- start_ovsdb__ NB nb OVN_Northbound NB_Global
+ start_ovsdb__ NB nb OVN_Northbound NB_Global "$OVSDB_NB_WRAPPER"
}
start_sb_ovsdb() {
@@ -313,7 +313,7 @@ start_sb_ovsdb() {
ulimit -n $MAXFD
fi
- start_ovsdb__ SB sb OVN_Southbound SB_Global
+ start_ovsdb__ SB sb OVN_Southbound SB_Global "$OVSDB_SB_WRAPPER"
}
start_ovsdb () {
@@ -322,11 +322,13 @@ start_ovsdb () {
}
start_ic_nb_ovsdb() {
- start_ovsdb__ IC_NB ic_nb OVN_IC_Northbound IC_NB_Global
+ start_ovsdb__ IC_NB ic_nb OVN_IC_Northbound IC_NB_Global \
+ "$OVSDB_NB_WRAPPER"
}
start_ic_sb_ovsdb() {
- start_ovsdb__ IC_SB ic_sb OVN_IC_Southbound IC_SB_Global
+ start_ovsdb__ IC_SB ic_sb OVN_IC_Southbound IC_SB_Global \
+ "$OVSDB_SB_WRAPPER"
}
start_ic_ovsdb () {
@@ -692,6 +694,8 @@ set_defaults () {
OVN_IC_WRAPPER=
OVN_CONTROLLER_PRIORITY=-10
OVN_CONTROLLER_WRAPPER=
+ OVSDB_NB_WRAPPER=
+ OVSDB_SB_WRAPPER=
OVN_USER=
@@ -908,6 +912,8 @@ Options:
--ovn-ic-sb-db-ssl-ca-cert=CERT OVN IC Southbound DB SSL CA certificate file
--ovn-user="user[:group]" pass the --user flag to the ovn daemons
--ovs-user="user[:group]" pass the --user flag to ovs daemons
+ --ovsdb-nb-wrapper=WRAPPER run with a wrapper like valgrind for debugging
+ --ovsdb-sb-wrapper=WRAPPER run with a wrapper like valgrind for debugging
-h, --help display this help message
File location options:
--- a/utilities/ovn-ctl.8.xml
+++ b/utilities/ovn-ctl.8.xml
@@ -64,6 +64,8 @@
<p><code>--ovn-controller-wrapper=<var>WRAPPER</var></code></p>
<p><code>--ovn-ic-priority=<var>NICE</var></code></p>
<p><code>--ovn-ic-wrapper=<var>WRAPPER</var></code></p>
+ <p><code>--ovsdb-nb-wrapper=<var>WRAPPER</var></code></p>
+ <p><code>--ovsdb-sb-wrapper=<var>WRAPPER</var></code></p>
<p><code>--ovn-user=<var>USER:GROUP</var></code></p>
<p><code>--ovs-user=<var>USER:GROUP</var></code></p>
<p><code>-h</code> | <code>--help</code></p>
--- a/utilities/ovn-lib.in
+++ b/utilities/ovn-lib.in
@@ -59,27 +59,12 @@ ovn_install_dir () {
fi
}
-start_ovn_daemon () {
- priority=$1
- wrapper=$2
- shift; shift
- daemon=$1
+start_wrapped_daemon() {
+ wrapper=$1
+ daemon=$2
+ priority=$3
strace=""
-
- # drop core files in a sensible place
- ovn_install_dir "$DAEMON_CWD"
- set "$@" --no-chdir
- cd "$DAEMON_CWD"
-
- # log file
- ovn_install_dir "$ovn_logdir" "750"
- set "$@" --log-file="$ovn_logdir/$daemon.log"
-
- # pidfile and monitoring
- ovn_install_dir "$ovn_rundir"
- set "$@" --pidfile="$ovn_rundir/$daemon.pid"
- set "$@" --detach
- test X"$MONITOR" = Xno || set "$@" --monitor
+ shift ; shift ; shift ;
# wrapper
case $wrapper in
@@ -127,6 +112,30 @@ start_ovn_daemon () {
fi
}
+start_ovn_daemon () {
+ priority=$1
+ wrapper=$2
+ shift; shift
+ daemon=$1
+
+ # drop core files in a sensible place
+ ovn_install_dir "$DAEMON_CWD"
+ set "$@" --no-chdir
+ cd "$DAEMON_CWD"
+
+ # log file
+ ovn_install_dir "$ovn_logdir" "750"
+ set "$@" --log-file="$ovn_logdir/$daemon.log"
+
+ # pidfile and monitoring
+ ovn_install_dir "$ovn_rundir"
+ set "$@" --pidfile="$ovn_rundir/$daemon.pid"
+ set "$@" --detach
+ test X"$MONITOR" = Xno || set "$@" --monitor
+
+ start_wrapped_daemon "$wrapper" $daemon "$priority" "$@"
+}
+
stop_ovn_daemon () {
if test -e "$ovn_rundir/$1.pid"; then
if pid=`cat "$ovn_rundir/$1.pid"`; then