[ovs-dev] [PATCH] rhel: Avoid losing bridge configuration after adding DPDK ports
Flavio Leitner
fbl at sysclose.org
Wed Feb 28 18:22:18 UTC 2018
On Wed, Feb 28, 2018 at 12:32:23PM +0000, Vishal Deep Ajmera wrote:
> Hi,
>
> If the patch looks fine I request to get this cherry-pick on 2.9 branch as well.
Makes sense to me.
fbl
>
> Warm Regards,
> Vishal Ajmera
>
> -----Original Message-----
> From: Vishal Deep Ajmera
> Sent: Friday, February 23, 2018 12:49 AM
> To: dev at openvswitch.org
> Cc: Vishal Deep Ajmera <vishal.deep.ajmera at ericsson.com>; Flavio Leitner <fbl at sysclose.org>
> Subject: [PATCH] rhel: Avoid losing bridge configuration after adding DPDK ports
>
> 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
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
--
Flavio
More information about the dev
mailing list