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