I tested this.  It turned out that "strace" also needed the -D option.
Other than that, it worked OK.

On Thu, Jun 14, 2012 at 06:35:54PM -0700, Justin Pettit wrote:
> Looks good.  Thanks.
> 
> --Justin
> 
> 
> On Jun 14, 2012, at 5:12 PM, Ben Pfaff wrote:
> 
> > This is occasionally useful for debugging.
> > 
> > Signed-off-by: Ben Pfaff <[email protected]>
> > ---
> > v1->v2: Use new dedicated options for configuring wrapper scripts,
> > instead of overloading the "priority" options.  Suggested by Justin.
> > 
> > utilities/ovs-ctl.8  |   25 +++++++++++++++++++++++++
> > utilities/ovs-ctl.in |   16 +++++++++++++---
> > utilities/ovs-lib.in |   27 ++++++++++++++++++++++++++-
> > 3 files changed, 64 insertions(+), 4 deletions(-)
> > 
> > diff --git a/utilities/ovs-ctl.8 b/utilities/ovs-ctl.8
> > index 6a1315f..1a9ee2a 100644
> > --- a/utilities/ovs-ctl.8
> > +++ b/utilities/ovs-ctl.8
> > @@ -183,6 +183,31 @@ suppresses that behavior.
> > Sets the \fBnice\fR(1) level used for each daemon.  All of them
> > default to \fB\-10\fR.
> > .
> > +.IP "\fB\-\-ovsdb\-server\-wrapper=\fIwrapper\fR"
> > +.IQ "\fB\-\-ovs\-vswitchd\-wrapper=\fIwrapper\fR"
> > +.IQ "\fB\-\-ovs\-brcompatd\-wrapper=\fIwrapper\fR"
> > +.
> > +Configures the specified daemon to run under \fIwrapper\fR, which is
> > +one of the following:
> > +.
> > +.RS
> > +.IP "\fBvalgrind\fR"
> > +Run the daemon under \fBvalgrind\fR(1), if it is installed, logging to
> > +\fIdaemon\fB.valgrind.log.\fIpid\fR in the log directory.
> > +.
> > +.IP "\fBstrace\fR"
> > +Run the daemon under \fBstrace\fR(1), if it is installed, logging to
> > +\fIdaemon\fB.strace.log.\fIpid\fR in the log directory.
> > +.RE
> > +.
> > +.IP
> > +By default, no wrapper is used.
> > +.
> > +.IP
> > +Wrappers greatly slow daemon operations so they should not be used in
> > +production.  They also produce voluminous logs that can quickly fill
> > +small disk partitions.
> > +.
> > .PP
> > The following options control file locations.  They should only be
> > used if the default locations cannot be used.  See \fBFILES\fR, below,
> > diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
> > index dfd6fa8..552cef3 100755
> > --- a/utilities/ovs-ctl.in
> > +++ b/utilities/ovs-ctl.in
> > @@ -188,7 +188,8 @@ start () {
> >     set "$@" --private-key=db:SSL,private_key
> >     set "$@" --certificate=db:SSL,certificate
> >     set "$@" --bootstrap-ca-cert=db:SSL,ca_cert
> > -   start_daemon "$OVSDB_SERVER_PRIORITY" "$@" || return 1
> > +   start_daemon "$OVSDB_SERVER_PRIORITY" "$OVSDB_SERVER_WRAPPER" "$@" \
> > +            || return 1
> > 
> >     # Initialize database settings.
> >     ovs_vsctl -- init -- set Open_vSwitch . db-version="$schemaver" \
> > @@ -215,7 +216,7 @@ start () {
> >     if test X"$MLOCKALL" != Xno; then
> >         set "$@" --mlockall
> >     fi
> > -   start_daemon "$OVS_VSWITCHD_PRIORITY" "$@"
> > +   start_daemon "$OVS_VSWITCHD_PRIORITY" "$OVS_VSWITCHD_WRAPPER" "$@"
> >     fi
> > 
> >     if daemon_is_running ovs-brcompatd; then
> > @@ -223,7 +224,7 @@ start () {
> >     elif test X"$BRCOMPAT" = Xyes; then
> >         set ovs-brcompatd
> >     set "$@" -vconsole:emer -vsyslog:err -vfile:info
> > -   start_daemon "$OVS_BRCOMPATD_PRIORITY" "$@"
> > +   start_daemon "$OVS_BRCOMPATD_PRIORITY" "$OVS_BRCOMPATD_WRAPPER" "$@"
> >     fi
> > }
> > 
> > @@ -377,6 +378,9 @@ set_defaults () {
> >     OVSDB_SERVER_PRIORITY=-10
> >     OVS_VSWITCHD_PRIORITY=-10
> >     OVS_BRCOMPATD_PRIORITY=-10
> > +    OVSDB_SERVER_WRAPPER=
> > +    OVS_VSWITCHD_WRAPPER=
> > +    OVS_BRCOMPATD_WRAPPER=
> > 
> >     DB_FILE=$etcdir/conf.db
> >     DB_SOCK=$rundir/db.sock
> > @@ -442,6 +446,12 @@ Less important options for "start" and 
> > "force-reload-kmod":
> >   --ovs-vswitchd-priority=NICE   set ovs-vswitchd's niceness (default: 
> > $OVS_VSWITCHD_PRIORITY)
> >   --ovs-brcompatd-priority=NICE  set ovs-brcompatd's niceness (default: 
> > $OVS_BRCOMPATD_PRIORITY)
> > 
> > +Debugging options for "start" and "force-reload-kmod":
> > +  --ovsdb-server-wrapper=WRAPPER
> > +  --ovs-vswitchd-wrapper=WRAPPER
> > +  --ovs-vswitchd-wrapper=WRAPPER
> > +     run specified daemon under WRAPPER (either 'valgrind' or 'strace')
> > +
> > Options for "start", "force-reload-kmod", "load-kmod", "status", and 
> > "version":
> >   --brcompat         enable Linux bridge compatibility module and daemon
> > 
> > diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in
> > index b8dc060..ed2fed6 100644
> > --- a/utilities/ovs-lib.in
> > +++ b/utilities/ovs-lib.in
> > @@ -88,7 +88,8 @@ pid_exists () {
> > 
> > start_daemon () {
> >     priority=$1
> > -    shift
> > +    wrapper=$2
> > +    shift; shift
> >     daemon=$1
> > 
> >     # drop core files in a sensible place
> > @@ -105,6 +106,30 @@ start_daemon () {
> >     set "$@" --pidfile="$rundir/$daemon.pid"
> >     set "$@" --detach --monitor
> > 
> > +    # wrapper
> > +    case $wrapper in
> > +        valgrind)
> > +            if (valgrind --version) > /dev/null 2>&1; then
> > +                set valgrind -q --leak-check=full \
> > +                    --log-file="$logdir/$daemon.valgrind.log.%p" "$@"
> > +            else
> > +                log_failure_msg "valgrind not installed, running $daemon 
> > without it"
> > +            fi
> > +            ;;
> > +        strace)
> > +            if (strace -V) > /dev/null 2>&1; then
> > +                set strace -ff -o "$logdir/$daemon.strace.log" "$@"
> > +            else
> > +                log_failure_msg "strace not installed, running $daemon 
> > without it"
> > +            fi
> > +            ;;
> > +        '')
> > +            ;;
> > +        *)
> > +            log_failure_msg "unknown wrapper $wrapper, running $daemon 
> > without it"
> > +            ;;
> > +    esac
> > +
> >     # priority
> >     if test X"$priority" != X; then
> >         set nice -n "$priority" "$@"
> > -- 
> > 1.7.2.5
> > 
> > _______________________________________________
> > dev mailing list
> > [email protected]
> > http://openvswitch.org/mailman/listinfo/dev
> 
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to