Browse Source

Don't add arp responder for non tunnel network port

When the vlan and vxlan both exist in env, and l2population
and arp_responder are enabled, if we update a port's ip address
from vlan network, there will be arp responder related flows
added into br-tun, this will cause too many arp reply for
one arp request, and vm connections will be unnormal.

Closes-Bug: #1824504
Change-Id: I1b6154b9433a9442d3e0118dedfa01c4a9b4740b
(cherry picked from commit 5301ecf41b)
changes/98/741798/1
Yang Li 1 year ago
committed by norman shen
parent
commit
585ae323d2
2 changed files with 36 additions and 0 deletions
  1. +7
    -0
      neutron/plugins/ml2/drivers/l2pop/mech_driver.py
  2. +29
    -0
      neutron/tests/unit/plugins/ml2/drivers/l2pop/test_mech_driver.py

+ 7
- 0
neutron/plugins/ml2/drivers/l2pop/mech_driver.py View File

@@ -120,6 +120,13 @@ class L2populationMechanismDriver(api.MechanismDriver):
if not agent_host:
return

# We should not add arp responder for non tunnel network type
port_context = context._plugin_context
agent = l2pop_db.get_agent_by_host(port_context, agent_host)
segment = context.bottom_bound_segment
if not self._validate_segment(segment, port['id'], agent):
return

agent_ip = l2pop_db.get_agent_ip_by_host(context._plugin_context,
agent_host)



+ 29
- 0
neutron/tests/unit/plugins/ml2/drivers/l2pop/test_mech_driver.py View File

@@ -1087,6 +1087,35 @@ class TestL2PopulationRpcTestCase(test_plugin.Ml2PluginV2TestCase):
self.mock_fanout.assert_called_with(
mock.ANY, 'add_fdb_entries', add_expected)

def test_fixed_ips_changed_vlan(self):
self._register_ml2_agents()

with self.subnet(network=self._network2) as subnet:
host_arg = {portbindings.HOST_ID: HOST}
fixed_ips = [{'subnet_id': subnet['subnet']['id'],
'ip_address': '10.0.0.2'}]
with self.port(subnet=subnet, cidr='10.0.0.0/24',
device_owner=DEVICE_OWNER_COMPUTE,
arg_list=(portbindings.HOST_ID,),
fixed_ips=fixed_ips,
**host_arg) as port:
p = port['port']

device = 'tap' + p['id']

self.callbacks.update_device_up(self.adminContext,
agent_id=HOST,
device=device)

data = {'port': {'fixed_ips': [{'ip_address': '10.0.0.2'},
{'ip_address': '10.0.0.10'}]}}
self.new_update_request('ports', data, p['id'])
l2pop_mech = l2pop_mech_driver.L2populationMechanismDriver()
l2pop_mech.L2PopulationAgentNotify = mock.Mock()
l2notify = l2pop_mech.L2PopulationAgentNotify
l2notify.update_fdb_entries = mock.Mock()
self.assertFalse(l2notify.update_fdb_entries.called)

def test_fixed_ips_changed(self):
self._register_ml2_agents()



Loading…
Cancel
Save