When we configure OVS using rhel ifupdown scripts,
we call ifup on a bridge twice. Once while configuring the
bridge and once while configuring the ports of the bridge.
This looks harmless but unnecessary. This patch fixes the
behavior.

Signed-off-by: Gurucharan Shetty <[email protected]>
---
 rhel/etc_sysconfig_network-scripts_ifup-ovs |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/rhel/etc_sysconfig_network-scripts_ifup-ovs 
b/rhel/etc_sysconfig_network-scripts_ifup-ovs
index ae095a0..14b9fe9 100755
--- a/rhel/etc_sysconfig_network-scripts_ifup-ovs
+++ b/rhel/etc_sysconfig_network-scripts_ifup-ovs
@@ -43,6 +43,13 @@ check_recursion()
        return 0
 }
 
+ifup_ovs_bridge()
+{
+       if ovs-vsctl br-exists "$OVS_BRIDGE"; then :; else
+               /sbin/ifup "$OVS_BRIDGE"
+       fi
+}
+
 if [ -z "${UPPEDSTACK}" ]; then
        UPPEDSTACK="${DEVICE}"
 fi
@@ -72,18 +79,18 @@ case "$TYPE" in
                exit 0
                ;;
        OVSPort)
-               /sbin/ifup "$OVS_BRIDGE"
+               ifup_ovs_bridge
                ${OTHERSCRIPT} ${CONFIG} ${2}
                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"
+               ifup_ovs_bridge
                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)
-               /sbin/ifup "$OVS_BRIDGE"
+               ifup_ovs_bridge
                for _iface in $BOND_IFACES; do
                        /sbin/ifup ${_iface}
                done
-- 
1.7.9.5

_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to