rhel: Add timeouts to network scripts.
authorBrian Kruger <bkruger+ovsdev@gmail.com>
Wed, 9 May 2012 16:13:42 +0000 (09:13 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 9 May 2012 19:32:17 +0000 (12:32 -0700)
If the daemon(s) aren't running for whatever reason, the RHEL ovs
ifup/ifdown scripts don't take that into account and an attempt to reboot a
system could take forever. (literally. endless loop!)  Here are a couple of
patches (one of ifup, one for ifdown) to add timeouts (10 seconds), because
it runs per interface you have configured and that could take awhile to
reboot a system if needed.

Signed-off-by: Brian Kruger <bkruger+ovsdev@gmail.com>
[blp@nicira.com fixed up a conflict against master]
Signed-off-by: Ben Pfaff <blp@nicira.com>
AUTHORS
rhel/etc_sysconfig_network-scripts_ifdown-ovs
rhel/etc_sysconfig_network-scripts_ifup-ovs

diff --git a/AUTHORS b/AUTHORS
index e207f3ca826d3a47fa0c6ec6a7d298fafe79e465..89472b33be0fd84dc2eedf6a50847cb2dfbae05c 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -8,6 +8,7 @@ Andrew Lambeth          wal@nicira.com
 Andy Southgate          andy.southgate@citrix.com
 Arun Sharma             arun.sharma@calsoftinc.com
 Ben Pfaff               blp@nicira.com
+Brian Kruger            bkruger+ovsdev@gmail.com
 Bryan Phillippe         bp@toroki.com
 Casey Barker            crbarker@google.com
 Chris Wright            chrisw@sous-sol.org
index 3b5252d7adb94f1773132433a97232dc962c9207..19047d8ba2464d3e96a4b3d906c2ee50364b7bb1 100755 (executable)
@@ -22,6 +22,7 @@ cd /etc/sysconfig/network-scripts
 [ -f ../network ] && . ../network
 
 CONFIG=${1}
+TIMEOUT=10
 
 source_config
 
@@ -37,12 +38,12 @@ case "$TYPE" in
        OVSBridge)
                ${OTHERSCRIPT} ${CONFIG} $2
                retval=$?
-               ovs-vsctl -- --if-exists del-br "$DEVICE"
+               ovs-vsctl -t ${TIMEOUT} -- --if-exists del-br "$DEVICE"
                ;;
        OVSPort|OVSIntPort|OVSBond)
                ${OTHERSCRIPT} ${CONFIG} $2
                retval=$?
-               ovs-vsctl -- --if-exists del-port "$OVS_BRIDGE" "$DEVICE"
+               ovs-vsctl -t ${TIMEOUT} -- --if-exists del-port "$OVS_BRIDGE" "$DEVICE"
                ;;
        *)
                echo $"Invalid OVS interface type $TYPE"
index b800ce050893d12a26566579f5d3f193d3baccbb..c42787903695fc1f4167d24c76f917be6b01ecab 100755 (executable)
@@ -22,6 +22,7 @@ cd /etc/sysconfig/network-scripts
 [ -f ../network ] && . ../network
 
 CONFIG=${1}
+TIMEOUT=10
 
 need_config ${CONFIG}
 
@@ -35,7 +36,7 @@ fi
 
 case "$TYPE" in
        OVSBridge)
-               ovs-vsctl -- --may-exist add-br "$DEVICE" $OVS_OPTIONS ${OVS_EXTRA+-- $OVS_EXTRA}
+               ovs-vsctl -t ${TIMEOUT} -- --may-exist add-br "$DEVICE" $OVS_OPTIONS ${OVS_EXTRA+-- $OVS_EXTRA}
                if [ "${OVSBOOTPROTO}" = "dhcp" ] && [ -n "${OVSINTF}" ]; then
                        case " ${OVSDHCPINTERFACES} " in
                                *" ${OVSINTF} "*)
@@ -50,12 +51,12 @@ case "$TYPE" in
        OVSPort)
                /sbin/ifup "$OVS_BRIDGE"
                ${OTHERSCRIPT} ${CONFIG} ${2}
-               ovs-vsctl -- --may-exist add-port "$OVS_BRIDGE" "$DEVICE" $OVS_OPTIONS ${OVS_EXTRA+-- $OVS_EXTRA}
+               ovs-vsctl -t ${TIMEOUT} -- --may-exist add-port "$OVS_BRIDGE" "$DEVICE" $OVS_OPTIONS ${OVS_EXTRA+-- $OVS_EXTRA}
                OVSINTF=${DEVICE} /sbin/ifup "$OVS_BRIDGE"
                ;;
        OVSIntPort)
                /sbin/ifup "$OVS_BRIDGE"
-               ovs-vsctl -- --may-exist add-port "$OVS_BRIDGE" "$DEVICE" $OVS_OPTIONS -- set Interface "$DEVICE" type=internal ${OVS_EXTRA+-- $OVS_EXTRA}
+               ovs-vsctl -t ${TIMEOUT} -- --may-exist add-port "$OVS_BRIDGE" "$DEVICE" $OVS_OPTIONS -- set Interface "$DEVICE" type=internal ${OVS_EXTRA+-- $OVS_EXTRA}
                ${OTHERSCRIPT} ${CONFIG} ${2}
                ;;
        OVSBond)
@@ -63,7 +64,7 @@ case "$TYPE" in
                for _iface in $BOND_IFACES; do
                        /sbin/ifup ${_iface}
                done
-               ovs-vsctl -- --fake-iface add-bond "$OVS_BRIDGE" "$DEVICE" ${BOND_IFACES} $OVS_OPTIONS ${OVS_EXTRA+-- $OVS_EXTRA}
+               ovs-vsctl -t ${TIMEOUT} -- --fake-iface add-bond "$OVS_BRIDGE" "$DEVICE" ${BOND_IFACES} $OVS_OPTIONS ${OVS_EXTRA+-- $OVS_EXTRA}
                ${OTHERSCRIPT} ${CONFIG} ${2}
                OVSINTF=${DEVICE} /sbin/ifup "$OVS_BRIDGE"
                ;;