patch: Remove veth driver.
[sliver-openvswitch.git] / xenserver / etc_init.d_openvswitch
index c972988..c6cc66b 100755 (executable)
 . /etc/xensource-inventory
 test -e /etc/sysconfig/openvswitch && . /etc/sysconfig/openvswitch
 
+NETWORK_MODE=$(cat /etc/xensource/network.conf)
+if test "$NETWORK_MODE" = bridge; then
+    echo "Open vSwitch disabled (/etc/xensource/network.conf is 'bridge')" >&2
+    exit 0
+fi
+
 # General config variables in /etc/sysconfig/openvswitch
 if test "$PRODUCT_VERSION" = "5.5.0"; then
     # XenServer 5.5.0 needs ovs-brcompatd and /proc/net simulation.
@@ -140,9 +146,6 @@ function insert_modules_if_required {
     if [ "$ENABLE_BRCOMPAT" = "y" ] && [ -n "$BRCOMPATD_PIDFILE" ] && ! lsmod | grep -q "brcompat_mod"; then
         action "Inserting brcompat module" modprobe brcompat_mod
     fi
-    if [ -f "/lib/modules/`uname -r`/kernel/extra/openvswitch/veth_mod.ko" ] && ! lsmod | grep -q "veth_mod"; then
-        action "Inserting veth module" modprobe veth_mod
-    fi
 }
 
 function remove_modules {
@@ -195,15 +198,15 @@ function start_daemon {
         exit 1
     elif test -n "$strace_log"; then
         local mode=strace
-        set -- $nice strace -o "$strace_log" $strace_opt "$@"
+        set -- strace -o "$strace_log" $strace_opt "$@"
     elif test -n "$valgrind_log"; then
         local mode=valgrind
-        set -- $nice valgrind --log-file="$valgrind_log" $valgrind_opt "$@"
+        set -- valgrind --log-file="$valgrind_log" $valgrind_opt "$@"
     else
         local mode=production
         eval local pidfile=\$${DAEMON}_PIDFILE
-        install -d -m 755 -o root -g root `dirname $VSWITCHD_PIDFILE`
-        set -- $nice "$@" --pidfile="$pidfile" --detach $monitor_opt --no-chdir
+        install -d -m 755 -o root -g root `dirname $pidfile`
+        set -- "$@" --pidfile="$pidfile" --detach $monitor_opt --no-chdir
     fi
 
     # Configure niceness.
@@ -216,7 +219,7 @@ function start_daemon {
         action "Starting `basename $BINARY`" "$@"
     else
         # Start in background and force a "success" message
-        action "Starting ovs-vswitchd with $mode debugging" true
+        action "Starting `basename $BINARY` with $mode debugging" true
         ("$@") &
     fi
 }
@@ -252,13 +255,7 @@ function start_brcompatd {
 }
 
 function start_xenserverd {
-    if [ ! -d "$XENSERVERD_RUN_DIR" ]; then
-        install -d -m 755 -o root -g root "$XENSERVERD_RUN_DIR"
-    fi
-    cd "$XENSERVERD_RUN_DIR"
-
-    install -d -m 755 -o root -g root `dirname $XENSERVERD_PIDFILE`
-    action "Starting ovs-xenserverd" "$xenserverd" --no-chdir --pidfile=$XENSERVERD_PIDFILE --detach $monitor_opt -vANY:CONSOLE:EMER
+    start_daemon XENSERVERD "$xenserverd"
 }
 
 function stop_daemon {
@@ -285,7 +282,7 @@ Restarting Open vSwitch on a live server is not guaranteed to work.  It is
 provided as a convenience for those situations in which it does work.
 
 EOF
-    read -s -r -n 1 -p "Countinue with restart (y/N): " response
+    read -s -r -n 1 -p "Continue with restart (y/N): " response
     printf "\n"
     case "$response" in
         y|Y)