From 28fff3f92d09737a2db0c98c590b7698917c2095 Mon Sep 17 00:00:00 2001 From: Guillaume Boutry Date: Mon, 6 May 2024 11:11:21 +0200 Subject: [PATCH] [neutron-k8s] Add MTU configuration options Add the following options to neutron-k8s: - global-physnet-mtu: set the global MTU for networks - path-mtu: MTU for overlay/tunnel network - physical-network-mtus: if using multiple physical networks with different MTUs Change-Id: I305c0570072ad7e3e7cf1e09b8998ca3f8bcc9fb --- charms/neutron-k8s/config.yaml | 27 +++++++++++++++++++ charms/neutron-k8s/src/charm.py | 1 - .../neutron-k8s/src/templates/ml2_conf.ini.j2 | 5 +++- .../neutron-k8s/src/templates/neutron.conf.j2 | 2 +- 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/charms/neutron-k8s/config.yaml b/charms/neutron-k8s/config.yaml index 86ada93a..f52c3e7d 100644 --- a/charms/neutron-k8s/config.yaml +++ b/charms/neutron-k8s/config.yaml @@ -46,3 +46,30 @@ options: default: False description: Enable IGMP snooping for integration bridge. type: boolean + global-physnet-mtu: + type: int + default: 1500 + description: | + MTU of the underlying physical network. Neutron uses this value to + calculate MTU for all virtual network components. For flat and + VLAN networks, neutron uses this value without modification. For + overlay networks such as VXLAN, neutron automatically subtracts + the overlay protocol overhead from this value. + path-mtu: + type: int + default: 1500 + description: | + Maximum size of an IP packet (MTU) that can traverse the + underlying physical network infrastructure without fragmentation + when using an overlay/tunnel protocol. This option allows + specifying a physical network MTU value that differs from the + default global-physnet-mtu value. + physical-network-mtus: + type: string + default: + description: | + Space-delimited list of : pairs specifying MTU for + individual physical networks. + . + Use this if a subset of your flat or VLAN provider networks have a MTU + that differ with what is set in global-physnet-mtu. diff --git a/charms/neutron-k8s/src/charm.py b/charms/neutron-k8s/src/charm.py index 13119535..b4809720 100755 --- a/charms/neutron-k8s/src/charm.py +++ b/charms/neutron-k8s/src/charm.py @@ -241,7 +241,6 @@ class OVNContext(sunbeam_ctxts.ConfigContext): "type_drivers": "geneve,gre,vlan,flat,local", "tenant_network_types": "geneve,gre,vlan,flat,local", "mechanism_drivers": "ovn", - "path_mtu": "1500", "tunnel_id_ranges": "1:1000", "vni_ranges": "1001:2000", "flat_networks": "physnet1", diff --git a/charms/neutron-k8s/src/templates/ml2_conf.ini.j2 b/charms/neutron-k8s/src/templates/ml2_conf.ini.j2 index f77d4b88..9c808dc6 100644 --- a/charms/neutron-k8s/src/templates/ml2_conf.ini.j2 +++ b/charms/neutron-k8s/src/templates/ml2_conf.ini.j2 @@ -8,7 +8,10 @@ type_drivers = {{ ovn.type_drivers }} tenant_network_types = {{ ovn.tenant_network_types }} mechanism_drivers = {{ ovn.mechanism_drivers }} -path_mtu = {{ ovn.path_mtu }} +path_mtu = {{ options.path_mtu }} +{% if options.physical_network_mtus %} +physical_network_mtus = {{ options.physical_network_mtus.split(' ') | join(',') }} +{% endif %} [ml2_type_gre] tunnel_id_ranges = {{ ovn.tunnel_id_ranges }} diff --git a/charms/neutron-k8s/src/templates/neutron.conf.j2 b/charms/neutron-k8s/src/templates/neutron.conf.j2 index b9940467..b589ba68 100644 --- a/charms/neutron-k8s/src/templates/neutron.conf.j2 +++ b/charms/neutron-k8s/src/templates/neutron.conf.j2 @@ -24,7 +24,7 @@ notify_nova_on_port_data_changes = True dns_domain = {{ options.dns_domain }} -global_physnet_mtu = 1500 +global_physnet_mtu = {{ options.global_physnet_mtu }} transport_url = {{ amqp.transport_url }}