From 3f9658dcd9b2cccdc0f03088723305c980130cd3 Mon Sep 17 00:00:00 2001 From: Vivekanandan Narasimhan Date: Wed, 14 May 2014 12:06:45 -0700 Subject: [PATCH] When l2-pop ON, clean stale ports in table0 br-tun When l2-pop is turned ON, the tunnels towards a specific node are created and torn down by other nodes, based on availability of ports on that specific node in specific networks. This generally reclaims the resources used for such tunnels in all the nodes. Under such conditions, in the current code (without this fix), the cleaned up ports continue to be present in rules of table0 of br-tun, resulting in flow explosion. This fix adds cleanup-logic to remove such rules that continue to use l2-pop cleaned up ports, from table0 of br-tun. Change-Id: I2639ff6432a13320adcadbcc0841319a99ce8c24 Closes-Bug: #1318261 --- .../openvswitch/agent/ovs_neutron_agent.py | 1 + .../unit/openvswitch/test_ovs_neutron_agent.py | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py b/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py index f42a29113..6c5fb56bb 100644 --- a/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py +++ b/neutron/plugins/openvswitch/agent/ovs_neutron_agent.py @@ -1080,6 +1080,7 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin, port_name = '%s-%s' % (tunnel_type, self.get_ip_in_hex(remote_ip)) self.tun_br.delete_port(port_name) + self.tun_br.delete_flows(in_port=ofport) self.tun_br_ofports[tunnel_type].pop(remote_ip, None) def treat_devices_added_or_updated(self, devices, ovs_restarted): diff --git a/neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py b/neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py index 79fdf08c4..b1d2371b3 100644 --- a/neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py +++ b/neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py @@ -624,19 +624,19 @@ class TestOvsNeutronAgent(base.BaseTestCase): mock.patch.object(self.agent.tun_br, 'delete_flows'), ) as (mod_flow_fn, del_flow_fn): self.agent.fdb_remove(None, fdb_entry) - del_flow_fn.assert_has_calls([ - mock.call(table=constants.ARP_RESPONDER, - proto='arp', - dl_vlan='vlan2', - nw_dst=FAKE_IP1), - mock.call(table=constants.UCAST_TO_TUN, - dl_vlan='vlan2', - dl_dst=FAKE_MAC) - ]) mod_flow_fn.assert_called_with(table=constants.FLOOD_TO_TUN, dl_vlan='vlan2', actions='strip_vlan,' 'set_tunnel:seg2,output:1') + expected = [mock.call(table=constants.ARP_RESPONDER, + proto='arp', + dl_vlan='vlan2', + nw_dst=FAKE_IP1), + mock.call(table=constants.UCAST_TO_TUN, + dl_vlan='vlan2', + dl_dst=FAKE_MAC), + mock.call(in_port='2')] + del_flow_fn.assert_has_calls(expected) def test_fdb_add_port(self): self._prepare_l2_pop_ofports() -- 2.45.2