Browse Source

Merge "[DVR] Fix update of the MTU in the DVR HA routers" into stable/train

changes/44/818344/1
Zuul 6 months ago committed by Gerrit Code Review
parent
commit
433d5e85bc
  1. 20
      neutron/agent/l3/dvr_edge_ha_router.py
  2. 11
      neutron/agent/l3/dvr_edge_router.py
  3. 10
      neutron/agent/l3/ha_router.py
  4. 5
      neutron/tests/functional/agent/l3/test_dvr_router.py

20
neutron/agent/l3/dvr_edge_ha_router.py

@ -14,10 +14,14 @@
# under the License.
from neutron_lib import constants
from oslo_log import log as logging
from neutron.agent.l3 import dvr_edge_router
from neutron.agent.l3 import ha_router
from neutron.agent.l3 import router_info
from neutron.common import utils as common_utils
LOG = logging.getLogger(__name__)
class DvrEdgeHaRouter(dvr_edge_router.DvrEdgeRouter,
@ -57,6 +61,22 @@ class DvrEdgeHaRouter(dvr_edge_router.DvrEdgeRouter,
self._get_snat_int_device_name,
constants.SNAT_INT_DEV_PREFIX)
def internal_network_updated(self, port):
interface_name = self.get_internal_device_name(port['id'])
ip_cidrs = common_utils.fixed_ip_cidrs(port['fixed_ips'])
mtu = port['mtu']
self.driver.set_mtu(interface_name, mtu, namespace=self.ns_name,
prefix=router_info.INTERNAL_DEV_PREFIX)
self._clear_vips(interface_name)
# NOTE(slaweq): qr- interface is not in ha_namespace but in qrouter
# namespace in case of dvr ha ruter
self._disable_ipv6_addressing_on_interface(
interface_name, namespace=self.ns_name)
for ip_cidr in ip_cidrs:
self._add_vip(ip_cidr, interface_name)
self._set_snat_interfce_mtu(port)
def add_centralized_floatingip(self, fip, fip_cidr):
interface_name = self.get_snat_external_device_interface_name(
self.get_ex_gw_port())

11
neutron/agent/l3/dvr_edge_router.py

@ -129,11 +129,7 @@ class DvrEdgeRouter(dvr_local_router.DvrLocalRouter):
lib_constants.SNAT_INT_DEV_PREFIX,
mtu=sn_port.get('mtu'))
def internal_network_updated(self, port):
super(DvrEdgeRouter, self).internal_network_updated(port)
if not port:
return
def _set_snat_interfce_mtu(self, port):
if not self._is_this_snat_host():
return
@ -146,6 +142,11 @@ class DvrEdgeRouter(dvr_local_router.DvrLocalRouter):
self.driver.set_mtu(interface_name, port['mtu'], namespace=ns_name,
prefix=lib_constants.SNAT_INT_DEV_PREFIX)
def internal_network_updated(self, port):
super(DvrEdgeRouter, self).internal_network_updated(port)
if port:
self._set_snat_interfce_mtu(port)
def _dvr_internal_network_removed(self, port):
super(DvrEdgeRouter, self)._dvr_internal_network_removed(port)

10
neutron/agent/l3/ha_router.py

@ -315,21 +315,23 @@ class HaRouter(router.RouterInfo):
return False
return True
def _disable_ipv6_addressing_on_interface(self, interface_name):
def _disable_ipv6_addressing_on_interface(self, interface_name,
namespace=None):
"""Disable IPv6 link local addressing on the device and add it as
a VIP to keepalived. This means that the IPv6 link local address
will only be present on the master.
"""
device = ip_lib.IPDevice(interface_name, namespace=self.ha_namespace)
namespace = namespace or self.ha_namespace
device = ip_lib.IPDevice(interface_name, namespace=namespace)
ipv6_lladdr = ip_lib.get_ipv6_lladdr(device.link.address)
if self._should_delete_ipv6_lladdr(ipv6_lladdr):
self.driver.configure_ipv6_ra(self.ha_namespace, interface_name,
self.driver.configure_ipv6_ra(namespace, interface_name,
n_consts.ACCEPT_RA_DISABLED)
device.addr.flush(n_consts.IP_VERSION_6)
else:
self.driver.configure_ipv6_ra(
self.ha_namespace, interface_name,
namespace, interface_name,
n_consts.ACCEPT_RA_WITHOUT_FORWARDING)
self._remove_vip(ipv6_lladdr)

5
neutron/tests/functional/agent/l3/test_dvr_router.py

@ -2258,7 +2258,7 @@ class TestDvrRouter(DvrRouterTestFramework, framework.L3AgentTestFramework):
router = self.manage_router(self.agent, router_info)
if ha:
utils.wait_until_true(lambda: router.ha_state == 'primary')
utils.wait_until_true(lambda: router.ha_state == 'master')
# Keepalived notifies of a state transition when it starts,
# not when it ends. Thus, we have to wait until keepalived finishes
# configuring everything. We verify this by waiting until the last
@ -2312,3 +2312,6 @@ class TestDvrRouter(DvrRouterTestFramework, framework.L3AgentTestFramework):
def test_dvr_router_interface_mtu_update(self):
self._test_router_interface_mtu_update(ha=False)
def test_dvr_ha_router_interface_mtu_update(self):
self._test_router_interface_mtu_update(ha=True)

Loading…
Cancel
Save