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
This commit is contained in:
Michael Smith 2014-11-10 15:49:14 -08:00
parent 49234a824c
commit 0a21b909ba
2 changed files with 7 additions and 1 deletions

View File

@ -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:

View File

@ -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)