unset OVSDB_SERVER_OPTS
unset OVS_VSWITCHD_OPTS
unset CORE_LIMIT
+unset ENABLE_MONITOR
default=/etc/default/openvswitch-switch
if [ -f $default ] ; then
. $default
fi
+: ${ENABLE_MONITOR:=y}
+
set -e
# running_pid pid name
/usr/share/openvswitch/vswitch-idl.ovsschema
fi
+ if test "$ENABLE_MONITOR" = y; then
+ monitor_opt=--monitor
+ else
+ monitor_opt=
+ fi
+
# Start ovsdb-server.
set --
set -- "$@" --verbose=ANY:console:emer --verbose=ANY:syslog:err
set -- "$@" --log-file
- set -- "$@" --detach --pidfile
+ set -- "$@" --detach --pidfile $monitor_opt
set -- "$@" --remote punix:/var/run/ovsdb-server
set -- "$@" /etc/openvswitch-switch/conf
set -- "$@" $OVSDB_SERVER_OPTS
set --
set -- "$@" --verbose=ANY:console:emer --verbose=ANY:syslog:err
set -- "$@" --log-file
- set -- "$@" --detach --pidfile
+ set -- "$@" --detach --pidfile $monitor_opt
set -- "$@" unix:/var/run/ovsdb-server
set -- "$@" $OVS_VSWITCHD_OPTS
echo -n "Starting ovs-vswitchd: "
# General config variables in /etc/sysconfig/vswitch
: ${ENABLE_BRCOMPAT:=y}
: ${ENABLE_FAKE_PROC_NET:=y}
+: ${ENABLE_MONITOR:=y}
: ${FORCE_COREFILES:=y}
# Config variables specific to ovsdb-server
ofctl="/usr/bin/ovs-ofctl"
vsctl="/usr/bin/ovs-vsctl"
-
if [ "$ENABLE_FAKE_PROC_NET" = "y" ]; then
if [ "$ENABLE_BRCOMPAT" != "y" ]; then
warning "FAKE_PROC_NET required BRCOMPAT which was disabled. Force enabling."
fi
fi
+if test "$ENABLE_MONITOR" = "y"; then
+ monitor_opt="--monitor"
+else
+ monitor_opt=
+fi
+
function dp_list {
"$dpctl" show | grep '^dp[0-9]\+:' | cut -d':' -f 1
}
if [ "$daemonize" != "y" ]; then
# Start in background and force a "success" message
action "Starting ovsdb_server ($strace_opt$valgrind_opt)" true
- (nice -n "$OVSDB_SERVER_PRIORITY" $strace_opt $valgrind_opt "$ovsdb_server" "$OVSDB_SERVER_DB" --pidfile="$OVSDB_SERVER_PIDFILE" --detach --no-chdir -vANY:CONSOLE:EMER $syslog_opt $logfile_level_opt $logfile_file_opt $leak_opt $remotes) &
+ (nice -n "$OVSDB_SERVER_PRIORITY" $strace_opt $valgrind_opt "$ovsdb_server" "$OVSDB_SERVER_DB" --pidfile="$OVSDB_SERVER_PIDFILE" --detach $monitor_opt --no-chdir -vANY:CONSOLE:EMER $syslog_opt $logfile_level_opt $logfile_file_opt $leak_opt $remotes) &
else
- action "Starting ovsdb-server" nice -n "$OVSDB_SERVER_PRIORITY" "$ovsdb_server" "$OVSDB_SERVER_DB" --pidfile="$OVSDB_SERVER_PIDFILE" --detach --no-chdir -vANY:CONSOLE:EMER $syslog_opt $logfile_level_opt $logfile_file_opt $leak_opt $remotes
+ action "Starting ovsdb-server" nice -n "$OVSDB_SERVER_PRIORITY" "$ovsdb_server" "$OVSDB_SERVER_DB" --pidfile="$OVSDB_SERVER_PIDFILE" --detach $monitor_opt --no-chdir -vANY:CONSOLE:EMER $syslog_opt $logfile_level_opt $logfile_file_opt $leak_opt $remotes
fi
}
if [ "$daemonize" != "y" ]; then
# Start in background and force a "success" message
action "Starting ovs-vswitchd ($strace_opt$valgrind_opt)" true
- (nice -n "$VSWITCHD_PRIORITY" $strace_opt $valgrind_opt "$vswitchd" --pidfile="$VSWITCHD_PIDFILE" --detach --no-chdir $fake_proc_net_opt -vANY:CONSOLE:EMER $syslog_opt $logfile_level_opt $logfile_file_opt $leak_opt "$VSWITCHD_OVSDB_SERVER") &
+ (nice -n "$VSWITCHD_PRIORITY" $strace_opt $valgrind_opt "$vswitchd" --pidfile="$VSWITCHD_PIDFILE" --detach $monitor_opt --no-chdir $fake_proc_net_opt -vANY:CONSOLE:EMER $syslog_opt $logfile_level_opt $logfile_file_opt $leak_opt "$VSWITCHD_OVSDB_SERVER") &
else
- action "Starting ovs-vswitchd" nice -n "$VSWITCHD_PRIORITY" "$vswitchd" --pidfile="$VSWITCHD_PIDFILE" --detach --no-chdir $fake_proc_net_opt -vANY:CONSOLE:EMER $syslog_opt $logfile_level_opt $logfile_file_opt $leak_opt "$VSWITCHD_OVSDB_SERVER"
+ action "Starting ovs-vswitchd" nice -n "$VSWITCHD_PRIORITY" "$vswitchd" --pidfile="$VSWITCHD_PIDFILE" --detach $monitor_opt --no-chdir $fake_proc_net_opt -vANY:CONSOLE:EMER $syslog_opt $logfile_level_opt $logfile_file_opt $leak_opt "$VSWITCHD_OVSDB_SERVER"
fi
}
action "Starting ovs-brcompatd ($strace_opt$valgrind_opt)" true
(nice -n "$VSWITCHD_PRIORITY" $strace_opt $valgrind_opt "$brcompatd"--no-chdir --appctl-command="$appctl_cmd" --pidfile=$BRCOMPATD_PIDFILE -vANY:CONSOLE:EMER $syslog_opt $logfile_level_opt $logfile_file_opt $leak_opt "$VSWITCHD_OVSDB_SERVER") &
else
- action "Starting ovs-brcompatd" nice -n "$BRCOMPATD_PRIORITY" $strace_opt $valgrind_opt "$brcompatd" --no-chdir --appctl-command="$appctl_cmd" --pidfile=$BRCOMPATD_PIDFILE --detach -vANY:CONSOLE:EMER $syslog_opt $logfile_level_opt $logfile_file_opt $leak_opt "$VSWITCHD_OVSDB_SERVER"
+ action "Starting ovs-brcompatd" nice -n "$BRCOMPATD_PRIORITY" $strace_opt $valgrind_opt "$brcompatd" --no-chdir --appctl-command="$appctl_cmd" --pidfile=$BRCOMPATD_PIDFILE --detach $monitor_opt -vANY:CONSOLE:EMER $syslog_opt $logfile_level_opt $logfile_file_opt $leak_opt "$VSWITCHD_OVSDB_SERVER"
fi
}
### Configuration options for vswitch
-# Copyright (C) 2009 Nicira Networks, Inc.
+# Copyright (C) 2009, 2010 Nicira Networks, Inc.
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# This is useful in some cases when replacing existing solutions.
# ENABLE_FAKE_PROC_NET=y
+# ENABLE_MONITOR: If 'y' then monitor daemon processes and restart them
+# if they die due to an error signal.
+# ENABLE_MONITOR=y
+
# FORCE_COREFILES: If 'y' then core files will be enabled.
# FORCE_COREFILES=y