]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fix for FIPs duplicated across hosts for DVR
authorMichael Smith <michael.smith6@hp.com>
Mon, 10 Nov 2014 23:49:14 +0000 (15:49 -0800)
committerMichael Smith <michael.smith6@hp.com>
Wed, 12 Nov 2014 17:22:59 +0000 (09:22 -0800)
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
neutron/tests/unit/test_l3_agent.py

index b6bb65a02d163b0c74d1f4bb60c4d2ebc0c24bc7..fcc923dfeb28ccd9ba0b80aff4c743c17ca0d846 100644 (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:
index 23f4d5a25b69a2857af4c1510ab35372962963ca..fb717c216a5e96363682ceb2033bd7d24c0ca7e9 100644 (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)