[ovs-dev] [PATCH] rhel: Avoid losing bridge configuration after adding DPDK ports
Vishal Deep Ajmera
vishal.deep.ajmera at ericsson.com
Thu Feb 22 19:18:49 UTC 2018
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 at ericsson.com>
Signed-off-by: Flavio Leitner <fbl at sysclose.org>
---
rhel/README.RHEL.rst | 5 +++++
rhel/etc_sysconfig_network-scripts_ifup-ovs | 16 ++++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/rhel/README.RHEL.rst b/rhel/README.RHEL.rst
index f3d2942..1cd2065 100644
--- a/rhel/README.RHEL.rst
+++ b/rhel/README.RHEL.rst
@@ -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
--------
diff --git a/rhel/etc_sysconfig_network-scripts_ifup-ovs b/rhel/etc_sysconfig_network-scripts_ifup-ovs
index b95220a..1c65f13 100755
--- a/rhel/etc_sysconfig_network-scripts_ifup-ovs
+++ b/rhel/etc_sysconfig_network-scripts_ifup-ovs
@@ -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"
--
1.9.1
More information about the dev
mailing list