From 0ce032275a1c6fa6b62efa9cb258212199aef1fc Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Thu, 9 Apr 2020 14:37:38 +0200 Subject: [PATCH] Ensure that stale flows are cleaned from phys_bridges In case when neutron-ovs-agent will notice that any of physical bridges was "re-created", we should also ensure that stale Open Flow rules (with old cookie id) are cleaned. This patch is doing exactly that. Change-Id: I7c7c8a4c371d6f4afdaab51ed50950e2b20db30f Related-Bug: #1864822 (cherry picked from commit 63c45b37666efc7fb33fc154fa828050b3dc7945) --- .../openvswitch/agent/ovs_neutron_agent.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py index 818dd29d4d1..445916553ec 100644 --- a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py +++ b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py @@ -2560,6 +2560,10 @@ class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin, added_bridges = idl_monitor.bridges_added + self.added_bridges bridges_recreated = self._reconfigure_physical_bridges( added_bridges) + if bridges_recreated: + # In case when any bridge was "re-created", we need to ensure + # that there is no any stale flows in bridges left + need_clean_stale_flow = True sync |= bridges_recreated # Notify the plugin of tunnel IP if self.enable_tunneling and tunnel_sync: @@ -2628,14 +2632,19 @@ class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin, ovs_restarted or bridges_recreated) failed_devices = self.process_network_ports( port_info, provisioning_needed) - if need_clean_stale_flow: - self.cleanup_stale_flows() - need_clean_stale_flow = False LOG.info("Agent rpc_loop - iteration:%(iter_num)d - " "ports processed. Elapsed:%(elapsed).3f", {'iter_num': self.iter_num, 'elapsed': time.time() - start}) + if need_clean_stale_flow: + self.cleanup_stale_flows() + need_clean_stale_flow = False + LOG.info("Agent rpc_loop - iteration:%(iter_num)d - " + "cleanup stale flows. Elapsed:%(elapsed).3f", + {'iter_num': self.iter_num, + 'elapsed': time.time() - start}) + ports = port_info['current'] if self.ancillary_brs: