]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Allow OVS default veth MTU to be configured.
authorJun Park <jun.park.earth@gmail.com>
Fri, 19 Jul 2013 17:58:00 +0000 (11:58 -0600)
committerJun Park <jun.park.earth@gmail.com>
Tue, 23 Jul 2013 17:56:23 +0000 (11:56 -0600)
In some environments where a packet is dropped when a VLAN tag is
added to the packet, you need to increase the MTU size of veth
interfaces to 1504.

Fixes: bug #1075336
Change-Id: I4f03b4cdc571a462096d419d6dd8324cf096156b

etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini
neutron/plugins/openvswitch/agent/ovs_neutron_agent.py
neutron/plugins/openvswitch/common/config.py
neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py
neutron/tests/unit/openvswitch/test_ovs_tunnel.py

index e20f606fca816f4176304e18eaab2b414c40c382..48442db5213576cd3bec3b646cc640676a37a2df 100644 (file)
 # vxlan_udp_port =
 # Example: vxlan_udp_port = 8472
 
+# (IntOpt) This is the MTU size of veth interfaces.
+# Do not change unless you have a good reason to.
+# The default MTU size of veth interfaces is 1500.
+# veth_mtu =
+# Example: veth_mtu = 1504
+
 [securitygroup]
 # Firewall driver for realizing neutron security group function.
 # firewall_driver = neutron.agent.firewall.NoopFirewallDriver
index 4c2d31da36926563ae2524672099289d6481371b..72bb80153ad1f0e20a4cea2bd5c60a7462709fb2 100644 (file)
@@ -150,7 +150,8 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin):
 
     def __init__(self, integ_br, tun_br, local_ip,
                  bridge_mappings, root_helper,
-                 polling_interval, tunnel_types=None):
+                 polling_interval, tunnel_types=None,
+                 veth_mtu=None):
         '''Constructor.
 
         :param integ_br: name of the integration bridge.
@@ -162,7 +163,9 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin):
         :param tunnel_types: A list of tunnel types to enable support for in
                the agent. If set, will automatically set enable_tunneling to
                True.
+        :param veth_mtu: MTU size for veth interfaces.
         '''
+        self.veth_mtu = veth_mtu
         self.root_helper = root_helper
         self.available_local_vlans = set(xrange(q_const.MIN_VLAN_TAG,
                                                 q_const.MAX_VLAN_TAG))
@@ -615,6 +618,11 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin):
             int_veth.link.set_up()
             phys_veth.link.set_up()
 
+            if self.veth_mtu:
+                # set up mtu size for veth interfaces
+                int_veth.link.set_mtu(self.veth_mtu)
+                phys_veth.link.set_mtu(self.veth_mtu)
+
     def update_ports(self, registered_ports):
         ports = self.int_br.get_vif_port_set()
         if ports == registered_ports:
@@ -825,6 +833,7 @@ def create_agent_config_map(config):
         root_helper=config.AGENT.root_helper,
         polling_interval=config.AGENT.polling_interval,
         tunnel_types=config.AGENT.tunnel_types,
+        veth_mtu=config.AGENT.veth_mtu,
     )
 
     # If enable_tunneling is TRUE, set tunnel_type to default to GRE
index 69a7a7f412c19946936f5c3e61dd6c0a936b9b2d..76e522f4fba5b1ed7baf2d9e613765706ec32bba 100644 (file)
@@ -67,6 +67,8 @@ agent_opts = [
                        "(gre and/or vxlan)")),
     cfg.IntOpt('vxlan_udp_port', default=constants.VXLAN_UDP_PORT,
                help=_("The UDP port to use for VXLAN tunnels.")),
+    cfg.IntOpt('veth_mtu', default=None,
+               help=_("MTU size of veth interfaces")),
 ]
 
 
index 33ad6b26b7ccca516abb9b916b2668d2d1c43596..f90cea843aa2c37a0b84375d5c49ff453a84c4e8 100644 (file)
@@ -311,10 +311,11 @@ class TestOvsNeutronAgent(base.BaseTestCase):
             mock.patch.object(self.agent.int_br, "delete_port"),
             mock.patch.object(ip_lib.IPWrapper, "add_veth"),
             mock.patch.object(ip_lib.IpLinkCommand, "delete"),
-            mock.patch.object(ip_lib.IpLinkCommand, "set_up")
+            mock.patch.object(ip_lib.IpLinkCommand, "set_up"),
+            mock.patch.object(ip_lib.IpLinkCommand, "set_mtu")
         ) as (devex_fn, sysexit_fn, remflows_fn, ovs_addfl_fn,
               ovs_addport_fn, ovs_delport_fn, br_addport_fn,
-              br_delport_fn, addveth_fn, linkdel_fn, linkset_fn):
+              br_delport_fn, addveth_fn, linkdel_fn, linkset_fn, linkmtu_fn):
             devex_fn.return_value = True
             addveth_fn.return_value = (ip_lib.IPDevice("int-br-eth1"),
                                        ip_lib.IPDevice("phy-br-eth1"))
index b1186e3301bb4fd99eb92d4d7c415cd1c41d6428..bf3ed41bfe89205ccadcc14865ecef50b0c7278f 100644 (file)
@@ -74,6 +74,7 @@ class TunnelTest(base.BaseTestCase):
         self.INT_OFPORT = 11111
         self.TUN_OFPORT = 22222
         self.MAP_TUN_OFPORT = 33333
+        self.VETH_MTU = None
         self.inta = self.mox.CreateMock(ip_lib.IPDevice)
         self.intb = self.mox.CreateMock(ip_lib.IPDevice)
         self.inta.link = self.mox.CreateMock(ip_lib.IpLinkCommand)
@@ -129,7 +130,8 @@ class TunnelTest(base.BaseTestCase):
         ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
                                           self.TUN_BRIDGE,
                                           '10.0.0.1', self.NET_MAPPING,
-                                          'sudo', 2, ['gre'])
+                                          'sudo', 2, ['gre'],
+                                          self.VETH_MTU)
         self.mox.VerifyAll()
 
     def testConstructVXLAN(self):
@@ -141,7 +143,8 @@ class TunnelTest(base.BaseTestCase):
         ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
                                           self.TUN_BRIDGE,
                                           '10.0.0.1', self.NET_MAPPING,
-                                          'sudo', 2, ['vxlan'])
+                                          'sudo', 2, ['vxlan'],
+                                          self.VETH_MTU)
         self.mox.VerifyAll()
 
     def testProvisionLocalVlan(self):
@@ -158,7 +161,8 @@ class TunnelTest(base.BaseTestCase):
         a = ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
                                               self.TUN_BRIDGE,
                                               '10.0.0.1', self.NET_MAPPING,
-                                              'sudo', 2, ['gre'])
+                                              'sudo', 2, ['gre'],
+                                              self.VETH_MTU)
         a.available_local_vlans = set([LV_ID])
         a.provision_local_vlan(NET_UUID, constants.TYPE_GRE, None, LS_ID)
         self.mox.VerifyAll()
@@ -178,7 +182,8 @@ class TunnelTest(base.BaseTestCase):
         a = ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
                                               self.TUN_BRIDGE,
                                               '10.0.0.1', self.NET_MAPPING,
-                                              'sudo', 2, ['gre'])
+                                              'sudo', 2, ['gre'],
+                                              self.VETH_MTU)
         a.available_local_vlans = set([LV_ID])
         a.phys_brs['net1'] = self.mock_map_tun_bridge
         a.phys_ofports['net1'] = self.MAP_TUN_OFPORT
@@ -191,7 +196,8 @@ class TunnelTest(base.BaseTestCase):
         a = ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
                                               self.TUN_BRIDGE,
                                               '10.0.0.1', self.NET_MAPPING,
-                                              'sudo', 2, ['gre'])
+                                              'sudo', 2, ['gre'],
+                                              self.VETH_MTU)
         a.provision_local_vlan(NET_UUID, constants.TYPE_FLAT, 'net2', LS_ID)
         self.mox.VerifyAll()
 
@@ -209,7 +215,8 @@ class TunnelTest(base.BaseTestCase):
         a = ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
                                               self.TUN_BRIDGE,
                                               '10.0.0.1', self.NET_MAPPING,
-                                              'sudo', 2, ['gre'])
+                                              'sudo', 2, ['gre'],
+                                              self.VETH_MTU)
         a.available_local_vlans = set([LV_ID])
         a.phys_brs['net1'] = self.mock_map_tun_bridge
         a.phys_ofports['net1'] = self.MAP_TUN_OFPORT
@@ -222,7 +229,8 @@ class TunnelTest(base.BaseTestCase):
         a = ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
                                               self.TUN_BRIDGE,
                                               '10.0.0.1', self.NET_MAPPING,
-                                              'sudo', 2, ['gre'])
+                                              'sudo', 2, ['gre'],
+                                              self.VETH_MTU)
         a.provision_local_vlan(NET_UUID, constants.TYPE_VLAN, 'net2', LS_ID)
         self.mox.VerifyAll()
 
@@ -235,7 +243,8 @@ class TunnelTest(base.BaseTestCase):
         a = ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
                                               self.TUN_BRIDGE,
                                               '10.0.0.1', self.NET_MAPPING,
-                                              'sudo', 2, ['gre'])
+                                              'sudo', 2, ['gre'],
+                                              self.VETH_MTU)
         a.available_local_vlans = set()
         a.local_vlan_map[NET_UUID] = LVM
         a.reclaim_local_vlan(NET_UUID, LVM)
@@ -253,7 +262,8 @@ class TunnelTest(base.BaseTestCase):
         a = ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
                                               self.TUN_BRIDGE,
                                               '10.0.0.1', self.NET_MAPPING,
-                                              'sudo', 2, ['gre'])
+                                              'sudo', 2, ['gre'],
+                                              self.VETH_MTU)
         a.phys_brs['net1'] = self.mock_map_tun_bridge
         a.phys_ofports['net1'] = self.MAP_TUN_OFPORT
         a.int_ofports['net1'] = self.INT_OFPORT
@@ -275,7 +285,8 @@ class TunnelTest(base.BaseTestCase):
         a = ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
                                               self.TUN_BRIDGE,
                                               '10.0.0.1', self.NET_MAPPING,
-                                              'sudo', 2, ['gre'])
+                                              'sudo', 2, ['gre'],
+                                              self.VETH_MTU)
         a.phys_brs['net1'] = self.mock_map_tun_bridge
         a.phys_ofports['net1'] = self.MAP_TUN_OFPORT
         a.int_ofports['net1'] = self.INT_OFPORT
@@ -300,7 +311,8 @@ class TunnelTest(base.BaseTestCase):
         a = ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
                                               self.TUN_BRIDGE,
                                               '10.0.0.1', self.NET_MAPPING,
-                                              'sudo', 2, ['gre'])
+                                              'sudo', 2, ['gre'],
+                                              self.VETH_MTU)
         a.local_vlan_map[NET_UUID] = LVM
         a.port_bound(VIF_PORT, NET_UUID, 'gre', None, LS_ID)
         self.mox.VerifyAll()
@@ -320,7 +332,8 @@ class TunnelTest(base.BaseTestCase):
         a = ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
                                               self.TUN_BRIDGE,
                                               '10.0.0.1', self.NET_MAPPING,
-                                              'sudo', 2, ['gre'])
+                                              'sudo', 2, ['gre'],
+                                              self.VETH_MTU)
         a.local_vlan_map[NET_UUID] = LVM
         a.port_bound(VIF_PORT, NET_UUID, 'gre', None, LS_ID)
         a.available_local_vlans = set([LV_ID])
@@ -339,7 +352,8 @@ class TunnelTest(base.BaseTestCase):
         a = ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
                                               self.TUN_BRIDGE,
                                               '10.0.0.1', self.NET_MAPPING,
-                                              'sudo', 2, ['gre'])
+                                              'sudo', 2, ['gre'],
+                                              self.VETH_MTU)
         a.available_local_vlans = set([LV_ID])
         a.local_vlan_map[NET_UUID] = LVM
         a.port_dead(VIF_PORT)
@@ -352,7 +366,8 @@ class TunnelTest(base.BaseTestCase):
         a = ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
                                               self.TUN_BRIDGE,
                                               '10.0.0.1', self.NET_MAPPING,
-                                              'sudo', 2, ['gre'])
+                                              'sudo', 2, ['gre'],
+                                              self.VETH_MTU)
         a.tunnel_update(
             mox.MockAnything, tunnel_id='1', tunnel_ip='10.0.10.1',
             tunnel_type=constants.TYPE_GRE)
@@ -363,7 +378,8 @@ class TunnelTest(base.BaseTestCase):
         a = ovs_neutron_agent.OVSNeutronAgent(self.INT_BRIDGE,
                                               self.TUN_BRIDGE,
                                               '10.0.0.1', self.NET_MAPPING,
-                                              'sudo', 2, ['gre'])
+                                              'sudo', 2, ['gre'],
+                                              self.VETH_MTU)
         a.tunnel_update(
             mox.MockAnything, tunnel_id='1', tunnel_ip='10.0.0.1')
         self.mox.VerifyAll()
@@ -403,7 +419,8 @@ class TunnelTest(base.BaseTestCase):
                                                     self.TUN_BRIDGE,
                                                     '10.0.0.1',
                                                     self.NET_MAPPING,
-                                                    'sudo', 2, ['gre'])
+                                                    'sudo', 2, ['gre'],
+                                                    self.VETH_MTU)
 
         # Hack to test loop
         # We start method and expect it will raise after 2nd loop
@@ -414,3 +431,12 @@ class TunnelTest(base.BaseTestCase):
             pass
 
         self.mox.VerifyAll()
+
+
+class TunnelTestWithMTU(TunnelTest):
+
+    def setUp(self):
+        super(TunnelTestWithMTU, self).setUp()
+        self.VETH_MTU = 1500
+        self.inta.link.set_mtu(self.VETH_MTU)
+        self.intb.link.set_mtu(self.VETH_MTU)