]> git.proxmox.com Git - mirror_ovs.git/commitdiff
rhel: Avoid losing bridge configuration after adding DPDK ports
authorVishal Deep Ajmera <vishal.deep.ajmera@ericsson.com>
Thu, 22 Feb 2018 19:18:49 +0000 (00:48 +0530)
committerRussell Bryant <russell@ovn.org>
Wed, 7 Mar 2018 15:54:53 +0000 (10:54 -0500)
Whenever a DPDK port is added to or deleted from an OVS bridge, the bridge
interface is reconfigured with the lowest MAC address among the connected DPDK
ports. When changing the MAC address, OVS performs a sequences of events
UP -> DOWN -> UP on the bridge interface. In deployments of OVS in RHEL
distribution this results in loosing Linux networking configuration attached to
the bridge interface (e.g. static routes).

This patch changes the interface configuration scripts used in a RHEL deployment
to trigger post-up operations on the bridge device after a change of MAC address.

Signed-off-by: Vishal Deep Ajmera <vishal.deep.ajmera@ericsson.com>
Signed-off-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Russell Bryant <russell@ovn.org>
rhel/README.RHEL.rst
rhel/etc_sysconfig_network-scripts_ifup-ovs

index f3d2942378dc41ace059bbf9f2fb02dbaf5513ee..1cd2065eff96ce240d35d12eeecef1f0021bc826 100644 (file)
@@ -93,6 +93,11 @@ Note
   answers: File exists`` printed on the console. This comes from ifup-eth
   trying to add zeroconf route multiple times and is harmless.
 
+* ``ifup`` on OVSDPDKPort or OVSDPDKBond may result in change of bridge mac address.
+  Since OVS changes the device state to DOWN before changing its mac address this
+  result in loss of bridge configuration (e.g. routes). ``ifup-ovs`` perform post-up
+  operation on the bridge again to restore configuration.
+
 Examples
 --------
 
index b95220a7fe72430c8d3c229e9792727591b9b56c..1c65f13e6535ac751174256ce37b148607c45c1c 100755 (executable)
@@ -167,10 +167,18 @@ case "$TYPE" in
                ;;
        OVSDPDKPort)
                ifup_ovs_bridge
+               BRIDGE_MAC_ORIG=$(get_hwaddr $OVS_BRIDGE)
                ovs-vsctl -t ${TIMEOUT} \
                        -- --if-exists del-port "$OVS_BRIDGE" "$DEVICE" \
                        -- add-port "$OVS_BRIDGE" "$DEVICE" $OVS_OPTIONS \
                        -- set Interface "$DEVICE" type=dpdk ${OVS_EXTRA+-- $OVS_EXTRA}
+               BRIDGE_MAC=$(get_hwaddr $OVS_BRIDGE)
+               # The bridge may change its MAC to be the lower one among all its
+               # ports. If that happens, bridge configuration (e.g. routes) will
+               # be lost. Restore the post-up bridge configuration again.
+               if [ "$BRIDGE_MAC_ORIG" != "$BRIDGE_MAC" ]; then
+                       ${OTHERSCRIPT} "$OVS_BRIDGE"
+               fi
                ;;
        OVSDPDKRPort)
                ifup_ovs_bridge
@@ -196,12 +204,20 @@ case "$TYPE" in
                ;;
        OVSDPDKBond)
                ifup_ovs_bridge
+               BRIDGE_MAC_ORIG=$(get_hwaddr $OVS_BRIDGE)
                for _iface in $BOND_IFACES; do
                        IFACE_TYPES="${IFACE_TYPES} -- set interface ${_iface} type=dpdk"
                done
                ovs-vsctl -t ${TIMEOUT} \
                        -- --if-exists del-port "$OVS_BRIDGE" "$DEVICE" \
                        -- add-bond "$OVS_BRIDGE" "$DEVICE" ${BOND_IFACES} $OVS_OPTIONS ${IFACE_TYPES} ${OVS_EXTRA+-- $OVS_EXTRA}
+               BRIDGE_MAC=$(get_hwaddr $OVS_BRIDGE)
+               # The bridge may change its MAC to be the lower one among all its
+               # ports. If that happens, bridge configuration (e.g. routes) will
+               # be lost. Restore the post-up bridge configuration again.
+               if [ "$BRIDGE_MAC_ORIG" != "$BRIDGE_MAC" ]; then
+                       ${OTHERSCRIPT} "$OVS_BRIDGE"
+               fi
                ;;
        *)
                echo $"Invalid OVS interface type $TYPE"