From bb22c94067b281ceec362061dd72c20d18342ab5 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Thu, 30 Nov 2017 18:26:56 +0000 Subject: [PATCH] Use largest MTU of interfaces when determining OVS veth MTU We create a veth pair to link the Linux bridge to the neutron Open vSwitch bridge. The MTU of the veth needs to be the largest MTU of the networks that it will carry. When VLAN subinterfaces are used, the provisioning network may map to the same bridge as one of the external networks, and we must use the largest MTU of these networks. --- ansible/network.yml | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/ansible/network.yml b/ansible/network.yml index 1636fed3f..84aa105a7 100644 --- a/ansible/network.yml +++ b/ansible/network.yml @@ -74,7 +74,7 @@ tags: - config vars: - veth_bridges: [] + veth_bridge_mtu_map: {} veth_interfaces: [] pre_tasks: # When these networks are VLANs, we need to use the underlying tagged @@ -83,28 +83,30 @@ # tagged interface may be shared between these networks. - name: Update a fact containing bridges to be patched to the Neutron OVS bridge set_fact: - veth_bridges: > - {{ veth_bridges | union([bridge_obj]) | list }} + veth_bridge_mtu_map: > + {{ veth_bridge_mtu_map | combine({interface: mtu}) }} with_items: "{{ [provision_wl_net_name] + external_net_names }}" when: item in network_interfaces vars: interface: "{{ item | net_interface | replace('.' ~ item | net_vlan | default('!nomatch!'), '') }}" - bridge_obj: - interface: "{{ interface }}" - mtu: "{{ item | net_mtu }}" + # Determine the MTU as the maximum of all subinterface MTUs. Only + # interfaces with an explicit MTU set will be taken account of. If no + # interface has an explicit MTU set, then the corresponding veth will + # not either. + mtu: "{{ [veth_bridge_mtu_map.get(interface), item | net_mtu] | max }}" - name: Update a fact containing veth interfaces set_fact: veth_interfaces: > {{ veth_interfaces + - [{'device': network_patch_prefix ~ item.interface ~ network_patch_suffix_phy, + [{'device': network_patch_prefix ~ item.key ~ network_patch_suffix_phy, 'bootproto': 'static', - 'bridge': item.interface, - 'mtu': item.mtu, - 'peer_device': network_patch_prefix ~ item.interface ~ network_patch_suffix_ovs, + 'bridge': item.key, + 'mtu': item.value, + 'peer_device': network_patch_prefix ~ item.key ~ network_patch_suffix_ovs, 'peer_bootproto': 'static', - 'peer_mtu': item.mtu, + 'peer_mtu': item.value, 'onboot': 'yes'}] }} - with_items: "{{ veth_bridges }}" + with_dict: "{{ veth_bridge_mtu_map }}" roles: - role: veth