Allow to config network MTU

We should allow the user to config the mtu
for the namespace networks and for VIFs when
the bridge driver is used.

Change-Id: I1685e31825f15387b6486713ce007b62e915df28
This commit is contained in:
Maysa Macedo 2020-10-21 21:56:22 +00:00
parent fd18e34791
commit 17f99a7178
3 changed files with 9 additions and 9 deletions

View File

@ -39,12 +39,9 @@ class BaseBridgeDriver(health.HealthHandler, b_base.BaseBindingDriver):
with b_base.get_ipdb() as h_ipdb: with b_base.get_ipdb() as h_ipdb:
self._remove_ifaces(h_ipdb, (host_ifname,)) self._remove_ifaces(h_ipdb, (host_ifname,))
if vif.network.mtu: interface_mtu = vif.network.mtu
interface_mtu = vif.network.mtu mtu_cfg = CONF.neutron_defaults.network_device_mtu
else: if mtu_cfg and mtu_cfg < interface_mtu:
LOG.info("Default mtu %(mtu)s is used for interface, "
"for mtu of network if configured with 0",
{"mtu": CONF.neutron_defaults.network_device_mtu})
interface_mtu = CONF.neutron_defaults.network_device_mtu interface_mtu = CONF.neutron_defaults.network_device_mtu
with b_base.get_ipdb(netns) as c_ipdb: with b_base.get_ipdb(netns) as c_ipdb:

View File

@ -223,7 +223,7 @@ neutron_defaults = [
default=None), default=None),
cfg.IntOpt('network_device_mtu', cfg.IntOpt('network_device_mtu',
help='Default MTU setting for network interface.', help='Default MTU setting for network interface.',
default=1500,), default=0,),
cfg.IntOpt('lbaas_activation_timeout', cfg.IntOpt('lbaas_activation_timeout',
help=_("Time (in seconds) that kuryr controller waits for " help=_("Time (in seconds) that kuryr controller waits for "
"neutron LBaaS to be activated"), "neutron LBaaS to be activated"),

View File

@ -158,10 +158,13 @@ class NamespacePodSubnetDriver(default_subnet.DefaultPodSubnetDriver):
except StopIteration: except StopIteration:
LOG.debug('Network does not exist. Creating.') LOG.debug('Network does not exist. Creating.')
mtu_cfg = oslo_cfg.CONF.neutron_defaults.network_device_mtu
attrs = {'name': net_name, 'project_id': project_id}
if mtu_cfg:
attrs['mtu'] = mtu_cfg
# create network with namespace as name # create network with namespace as name
try: try:
neutron_net = os_net.create_network(name=net_name, neutron_net = os_net.create_network(**attrs)
project_id=project_id)
c_utils.tag_neutron_resources([neutron_net]) c_utils.tag_neutron_resources([neutron_net])
except os_exc.SDKException: except os_exc.SDKException:
LOG.exception("Error creating neutron resources for the namespace " LOG.exception("Error creating neutron resources for the namespace "