From 42a5a48c37400b0241f7792cf2ecb3cf630a1910 Mon Sep 17 00:00:00 2001 From: Brian Haley Date: Tue, 9 Apr 2019 15:08:32 -0400 Subject: [PATCH] DVR: Correctly change MTU in fip namespace The code that ensures the fpr/rfp veth pair exists between the qrouter and fip namespace was only setting the mtu of the devices if it had to create them. Set it all the time to support the mtu being changed. Change-Id: I176b5f4d4f12cf09f930e2c1944e98082a09bcc6 Closes-bug: #1823798 (cherry picked from commit 6ded6d217adf61216fb10383d0150c966b92f11c) --- neutron/agent/l3/dvr_fip_ns.py | 9 +++++---- neutron/tests/unit/agent/l3/test_dvr_fip_ns.py | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/neutron/agent/l3/dvr_fip_ns.py b/neutron/agent/l3/dvr_fip_ns.py index 4623caad294..037d2691a3d 100644 --- a/neutron/agent/l3/dvr_fip_ns.py +++ b/neutron/agent/l3/dvr_fip_ns.py @@ -443,13 +443,14 @@ class FipNamespace(namespaces.Namespace): rtr_2_fip_dev, fip_2_rtr_dev = ip_wrapper.add_veth(rtr_2_fip_name, fip_2_rtr_name, fip_ns_name) - mtu = ri.get_ex_gw_port().get('mtu') - if mtu: - rtr_2_fip_dev.link.set_mtu(mtu) - fip_2_rtr_dev.link.set_mtu(mtu) rtr_2_fip_dev.link.set_up() fip_2_rtr_dev.link.set_up() + mtu = ri.get_ex_gw_port().get('mtu') + if mtu: + rtr_2_fip_dev.link.set_mtu(mtu) + fip_2_rtr_dev.link.set_mtu(mtu) + self._add_cidr_to_device(rtr_2_fip_dev, str(rtr_2_fip)) self._add_cidr_to_device(fip_2_rtr_dev, str(fip_2_rtr)) diff --git a/neutron/tests/unit/agent/l3/test_dvr_fip_ns.py b/neutron/tests/unit/agent/l3/test_dvr_fip_ns.py index 01790040b96..6ec2aa49154 100644 --- a/neutron/tests/unit/agent/l3/test_dvr_fip_ns.py +++ b/neutron/tests/unit/agent/l3/test_dvr_fip_ns.py @@ -302,10 +302,11 @@ class TestDvrFipNs(base.BaseTestCase): fip_2_rtr_name, fip_ns_name) - device.link.set_mtu.assert_called_with(2000) - self.assertEqual(2, device.link.set_mtu.call_count) self.assertEqual(2, device.link.set_up.call_count) + device.link.set_mtu.assert_called_with(2000) + self.assertEqual(2, device.link.set_mtu.call_count) + if not addr_exists: expected = [mock.call(str(addr_pair[0]), add_broadcast=False), mock.call(str(addr_pair[1]), add_broadcast=False)]