debian: Don't depened on $RUNLEVEL at startup to create bridges.
authorGurucharan Shetty <gshetty@nicira.com>
Thu, 11 Sep 2014 16:35:10 +0000 (09:35 -0700)
committerGurucharan Shetty <gshetty@nicira.com>
Fri, 12 Sep 2014 16:18:06 +0000 (09:18 -0700)
Commit b2a0daa5bd (debian: Don't recreate bridges during manual restart.)
added a check on $RUNLEVEL to only create bridges and ports when the
system starts up. This fix does not work with systemd.

This commit uses a different approach to solve the same problem.

Reported-at: https://bugs.debian.org/686518
Reported-by: Philipp S. Schmidt <phils@in-panik.de>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Tested-by: Philipp S. Schmidt <phils@in-panik.de>
debian/openvswitch-switch.init

index 481b29c..bf84477 100755 (executable)
@@ -31,7 +31,6 @@
 test -e /etc/default/openvswitch-switch && . /etc/default/openvswitch-switch
 
 network_interfaces () {
-    [ -z "${RUNLEVEL}" ] && return
     INTERFACES="/etc/network/interfaces"
     [ -e "${INTERFACES}" ] || return
     bridges=`awk '{ if ($1 == "allow-ovs") { print $2; } }' "${INTERFACES}"`
@@ -67,11 +66,13 @@ start () {
     fi
     set "$@" $OVS_CTL_OPTS
     "$@" || exit $?
-    [ "$2" = "start" ] && network_interfaces ifup
+    if [ "$2" = "start" ] && [ "$READ_INTERFACES" != "no" ]; then
+        network_interfaces ifup
+    fi
 }
 
 stop () {
-    network_interfaces ifdown
+    [ "$READ_INTERFACES" != "no" ] && network_interfaces ifdown
     ovs_ctl stop
 }
 
@@ -106,8 +107,8 @@ restart () {
             start restart
         fi
     else
-        stop
-        start
+        READ_INTERFACES="no" stop
+        READ_INTERFACES="no" start
     fi
 }