Fix force-reload-kmod initscript command implementations.
authorBen Pfaff <blp@nicira.com>
Fri, 17 Jun 2011 23:24:54 +0000 (16:24 -0700)
committerBen Pfaff <blp@nicira.com>
Mon, 20 Jun 2011 18:46:52 +0000 (11:46 -0700)
I screwed this up in the recent conversion.

Signed-off-by: Ben Pfaff <blp@nicira.com>
debian/openvswitch-switch.init
xenserver/etc_init.d_openvswitch

index 9c7343b3fc5eb7c082f01122abfa1d545021ae13..a65af0ce1546c52368b769bf1867ad9cb6153134 100755 (executable)
 
 (test -x /usr/sbin/ovs-vswitchd && test -x /usr/bin/ovsdb-server) || exit 0
 
-set -e
-
 test -e /etc/default/openvswitch-switch && . /etc/default/openvswitch-switch
 
 ovs_ctl=/usr/share/openvswitch/scripts/ovs-ctl
-case $1 in
-    start)
-       set $ovs_ctl start --system-id=random
-       if test X"$FORCE_COREFILES" != X; then
-           set "$@" --force-corefiles="$FORCE_COREFILES"
-       fi
 
-       # Allow GRE traffic.
-        test ! -x /sbin/iptables || /sbin/iptables -I INPUT -p gre -j ACCEPT
+start () {
+    set $ovs_ctl ${1-start} --system-id=random
+    if test X"$FORCE_COREFILES" != X; then
+       set "$@" --force-corefiles="$FORCE_COREFILES"
+    fi
 
-       "$@"
-        ;;
+    # Allow GRE traffic.
+    test ! -x /sbin/iptables || /sbin/iptables -I INPUT -p gre -j ACCEPT
+
+    "$@"
+}
+
+stop () {
+    $ovs_ctl stop
+}
+
+case $1 in
+    start)
+        start
+       ;;
     stop | force-stop)
-        $ovs_ctl stop
+        stop
         ;;
     reload | force-reload)
         # The OVS daemons keep up-to-date.
         ;;
     restart)
-        $0 stop || true
-        $0 start
+        stop
+        start
         ;;
     status)
         $ovs_ctl status
         ;;
+    force-reload-kmod)
+        start force-reload-kmod
+        ;;
     *)
-        echo "Usage: $0 {start|stop|restart|force-reload|status|force-stop}" >&2
+        echo "Usage: $0 {start|stop|restart|force-reload|status|force-stop|force-reload-kmod}" >&2
         exit 1
         ;;
 esac
index d638846947666a3e96adb0428e12ffd84f241115..39d4d364e824b92f3c0d3f612351cc5f88ebb669 100755 (executable)
@@ -44,7 +44,7 @@ case `cat /etc/xensource/network.conf` in
 esac
 
 start () {
-    set $ovs_ctl start
+    set $ovs_ctl ${1-start}
     set "$@" --system-id="$INSTALLATION_UUID"
     set "$@" --system-type="$PRODUCT_BRAND"
     set "$@" --system-version="$PRODUCT_VERSION-$BUILD_NUMBER"
@@ -115,7 +115,7 @@ case $1 in
         $ovs_ctl version
         ;;
     force-reload-kmod)
-        $ovs_ctl force-reload-kmod
+        start force-reload-kmod
         ;;
     help)
         printf "openvswitch [start|stop|restart|reload|force-reload|status|version]\n"