From 0a21b909baa11e4655852c27ab282c32e0aa7a94 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Mon, 10 Nov 2014 15:49:14 -0800 Subject: [PATCH] Fix for FIPs duplicated across hosts for DVR For DVR, FIPs should be hosted on the single node which hosts the VM assigned with the fixed_ip of the FIP. The l3_agent should only take action on the correct FIP per host by filtering the FIPs based on the 'host' value of the FIP. A recent refactor on the l3_agent moved the host filtering logic from process_router_floating_ip_addresses() to _get_external_device_interface_name(). The local floating_ips var was not altered as it was before the refactor. This resulted in network disruption across multiple hosts since more than one namespace contained the FIP. This problem would only be seen in a mutli-host environment where the same router hosting FIPs was present on more than one node. The fix is to return the host filtering logic by adding a call to get_floating_ips(). In addition, the unit test test_process_router_dist_floating_ip_add() was modified to pass two FIPs instead of one. One FIP matches the host of the agent, one does not. Only one should be processed, not two. Change-Id: I67b19f6228af392519fff89b13283b43921552bf Closes-bug: #1389880 --- neutron/agent/l3_agent.py | 2 +- neutron/tests/unit/test_l3_agent.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/neutron/agent/l3_agent.py b/neutron/agent/l3_agent.py index b6bb65a02..fcc923dfe 100644 --- a/neutron/agent/l3_agent.py +++ b/neutron/agent/l3_agent.py @@ -1167,7 +1167,7 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback, """ fip_statuses = {} - floating_ips = ri.router.get(l3_constants.FLOATINGIP_KEY, []) + floating_ips = self.get_floating_ips(ri) interface_name = self._get_external_device_interface_name( ri, ex_gw_port, floating_ips) if interface_name is None: diff --git a/neutron/tests/unit/test_l3_agent.py b/neutron/tests/unit/test_l3_agent.py index 23f4d5a25..fb717c216 100644 --- a/neutron/tests/unit/test_l3_agent.py +++ b/neutron/tests/unit/test_l3_agent.py @@ -1150,6 +1150,12 @@ vrrp_instance VR_1 { 'floating_ip_address': '15.1.2.3', 'fixed_ip_address': '192.168.0.1', 'floating_network_id': _uuid(), + 'port_id': _uuid()}, + {'id': _uuid(), + 'host': 'some-other-host', + 'floating_ip_address': '15.1.2.4', + 'fixed_ip_address': '192.168.0.10', + 'floating_network_id': _uuid(), 'port_id': _uuid()}]} router = prepare_router_data(enable_snat=True) -- 2.45.2