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.
This commit is contained in:
Mark Goddard
2017-11-30 18:26:56 +00:00
parent 1eff7466c6
commit bb22c94067

View File

@@ -74,7 +74,7 @@
tags: tags:
- config - config
vars: vars:
veth_bridges: [] veth_bridge_mtu_map: {}
veth_interfaces: [] veth_interfaces: []
pre_tasks: pre_tasks:
# When these networks are VLANs, we need to use the underlying tagged # When these networks are VLANs, we need to use the underlying tagged
@@ -83,28 +83,30 @@
# tagged interface may be shared between these networks. # tagged interface may be shared between these networks.
- name: Update a fact containing bridges to be patched to the Neutron OVS bridge - name: Update a fact containing bridges to be patched to the Neutron OVS bridge
set_fact: set_fact:
veth_bridges: > veth_bridge_mtu_map: >
{{ veth_bridges | union([bridge_obj]) | list }} {{ veth_bridge_mtu_map | combine({interface: mtu}) }}
with_items: "{{ [provision_wl_net_name] + external_net_names }}" with_items: "{{ [provision_wl_net_name] + external_net_names }}"
when: item in network_interfaces when: item in network_interfaces
vars: vars:
interface: "{{ item | net_interface | replace('.' ~ item | net_vlan | default('!nomatch!'), '') }}" interface: "{{ item | net_interface | replace('.' ~ item | net_vlan | default('!nomatch!'), '') }}"
bridge_obj: # Determine the MTU as the maximum of all subinterface MTUs. Only
interface: "{{ interface }}" # interfaces with an explicit MTU set will be taken account of. If no
mtu: "{{ item | net_mtu }}" # 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 - name: Update a fact containing veth interfaces
set_fact: set_fact:
veth_interfaces: > veth_interfaces: >
{{ 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', 'bootproto': 'static',
'bridge': item.interface, 'bridge': item.key,
'mtu': item.mtu, 'mtu': item.value,
'peer_device': network_patch_prefix ~ item.interface ~ network_patch_suffix_ovs, 'peer_device': network_patch_prefix ~ item.key ~ network_patch_suffix_ovs,
'peer_bootproto': 'static', 'peer_bootproto': 'static',
'peer_mtu': item.mtu, 'peer_mtu': item.value,
'onboot': 'yes'}] }} 'onboot': 'yes'}] }}
with_items: "{{ veth_bridges }}" with_dict: "{{ veth_bridge_mtu_map }}"
roles: roles:
- role: veth - role: veth