fix kury-cni exits unexpectedly when MTU of network is 0

If the MTU of the netowrk of interface is 0,
"Netlink Error, invalid argument" will be raised,
and kury-cni exits unexpectedly.

When mtu is 0,
1. dhcp-option-force of dnsmasq for is not set,
   and mtu of interface of vm is set to be 1500 by default
2. mtu of qvo-xxx and qvb-xxx is set to 1500,
   which is determined by configuration,network_device_mtu.

Fix this by adding default network device MTU configuration,
which is used instead if MTU of network is 0

Change-Id: I7c1140b116aa6304aca13479a7d7eb82d828d16f
Close-Bug: 1738812
This commit is contained in:
QingchuanHao 2018-03-14 17:41:14 +08:00
parent 096346fb40
commit c00513bb64
2 changed files with 13 additions and 2 deletions

View File

@ -43,10 +43,18 @@ class BaseBridgeDriver(health.HealthHandler):
with h_ipdb.interfaces[host_ifname] as h_iface:
h_iface.remove()
if vif.network.mtu:
interface_mtu = vif.network.mtu
else:
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
with b_base.get_ipdb(netns) as c_ipdb:
with c_ipdb.create(ifname=ifname, peer=host_ifname,
kind='veth') as c_iface:
c_iface.mtu = vif.network.mtu
c_iface.mtu = interface_mtu
c_iface.address = str(vif.address)
c_iface.up()
@ -56,7 +64,7 @@ class BaseBridgeDriver(health.HealthHandler):
with b_base.get_ipdb() as h_ipdb:
with h_ipdb.interfaces[host_ifname] as h_iface:
h_iface.mtu = vif.network.mtu
h_iface.mtu = interface_mtu
h_iface.up()
def disconnect(self, vif, ifname, netns):

View File

@ -163,6 +163,9 @@ neutron_defaults = [
cfg.StrOpt('external_svc_subnet',
help=_("Optional external subnet ID for Kubernetes services"),
default=None),
cfg.IntOpt('network_device_mtu',
help='Default MTU setting for network interface.',
default=1500,),
]
octavia_defaults = [