Add support for configuring individual physical network MTUs

This is needed if a subset of your flat or VLAN provider networks have a MTU
that differ with what is set in global-physnet-mtu.

Change-Id: Ifd348311b5c313fa95d6ed49c32d9b26b0f5e662
Closes-Bug: #1663533
This commit is contained in:
Frode Nordahl 2018-02-01 09:47:47 +01:00
parent 39fa6f26d2
commit 08e806f098
4 changed files with 82 additions and 0 deletions

View File

@ -267,6 +267,15 @@ options:
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 <physical_network>:<mtu> 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.
dns-domain:
type: string
default: openstack.example.

View File

@ -432,6 +432,10 @@ class NeutronCCContext(context.NeutronContext):
ctxt['path_mtu'] = config('path-mtu')
else:
ctxt['path_mtu'] = config('global-physnet-mtu')
physical_network_mtus = config('physical-network-mtus')
if physical_network_mtus:
ctxt['physical_network_mtus'] = ','.join(
physical_network_mtus.split())
if 'kilo' <= cmp_release <= 'mitaka':
pci_vendor_devs = config('supported-pci-vendor-devs')

View File

@ -16,6 +16,9 @@ type_drivers = {{ tenant_network_types }}
tenant_network_types = {{ tenant_network_types }}
mechanism_drivers = {{ mechanism_drivers }}
{% if physical_network_mtus -%}
physical_network_mtus = {{ physical_network_mtus }}
{% endif -%}
{% if path_mtu -%}
path_mtu = {{ path_mtu }}
{% endif -%}

View File

@ -450,6 +450,48 @@ class NeutronCCContextTest(CharmTestCase):
with patch.object(napi_ctxt, '_ensure_packages'):
self.assertEqual(ctxt_data, napi_ctxt())
@patch.object(context.NeutronCCContext, 'network_manager')
@patch.object(context.NeutronCCContext, 'plugin')
@patch('builtins.__import__')
def test_neutroncc_context_no_setting_mitaka(self, _import, plugin, nm):
plugin.return_value = None
ctxt_data = {
'debug': True,
'enable_dvr': False,
'l3_ha': False,
'mechanism_drivers': 'openvswitch,hyperv,l2population',
'dhcp_agents_per_network': 3,
'enable_sriov': False,
'external_network': 'bob',
'global_physnet_mtu': 1500,
'neutron_bind_port': self.api_port,
'verbose': True,
'l2_population': True,
'overlay_network_type': 'gre',
'path_mtu': 1500,
'tenant_network_types': 'gre,vlan,flat,local',
'quota_floatingip': 50,
'quota_health_monitors': -1,
'quota_member': -1,
'quota_network': 10,
'quota_pool': 10,
'quota_port': 50,
'quota_router': 10,
'quota_security_group': 10,
'quota_security_group_rule': 100,
'quota_subnet': 10,
'quota_vip': 10,
'vlan_ranges': 'physnet1:1000:2000',
'vni_ranges': '1001:2000',
'extension_drivers': 'port_security',
'service_plugins': 'router,firewall,lbaas,vpnaas,metering',
}
napi_ctxt = context.NeutronCCContext()
self.maxDiff = None
self.os_release.return_value = 'mitaka'
with patch.object(napi_ctxt, '_ensure_packages'):
self.assertEqual(ctxt_data, napi_ctxt())
@patch.object(context.NeutronCCContext, 'network_manager')
@patch.object(context.NeutronCCContext, 'plugin')
def test_neutroncc_context_dns_setting(self, plugin, nm):
@ -810,6 +852,30 @@ class NeutronCCContextTest(CharmTestCase):
self.assertEqual(context.NeutronCCContext()()['service_plugins'],
service_plugins)
@patch.object(context.NeutronCCContext, 'network_manager')
@patch.object(context.NeutronCCContext, 'plugin')
def test_neutroncc_context_physical_network_mtus(self, plugin, nm):
plugin.return_value = None
self.test_config.set('physical-network-mtus', 'provider1:4000')
self.os_release.return_value = 'mitaka'
napi_ctxt = context.NeutronCCContext()
with patch.object(napi_ctxt, '_ensure_packages'):
ctxt = napi_ctxt()
self.assertEqual(ctxt['physical_network_mtus'], 'provider1:4000')
@patch.object(context.NeutronCCContext, 'network_manager')
@patch.object(context.NeutronCCContext, 'plugin')
def test_neutroncc_context_physical_network_mtus_multi(self, plugin, nm):
plugin.return_value = None
self.test_config.set('physical-network-mtus',
'provider1:4000 provider2:5000')
self.os_release.return_value = 'mitaka'
napi_ctxt = context.NeutronCCContext()
with patch.object(napi_ctxt, '_ensure_packages'):
ctxt = napi_ctxt()
self.assertEqual(ctxt['physical_network_mtus'],
'provider1:4000,provider2:5000')
class EtcdContextTest(CharmTestCase):