From ae031d18866a9e3652f4fc122f120915209a7b29 Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Wed, 28 Nov 2018 22:42:18 +0100 Subject: [PATCH] Force all fdb entries update after ovs-vswitchd restart When ovs-vswitchd process is restarted neutron-ovs-agent will handle it and reconfigure all ports and openflows in bridges. Unfortunatelly when tunnel networks are used together with L2pop mechanism driver, this driver will not notice that agent lost all openflow config and will not send all fdb entries which should be added on host. In such case L2pop mechanism driver should behave in same way like when neutron-ovs-agent is restarted and send all fdb_entries to agent. This patch adds "simulate" of agent start flag when ovs_restart is handled thus neutron-server will send all fdb_entries to agent and tunnels openflow rules can be reconfigured properly. Change-Id: I5f1471e20bbad90c4cdcbc6c06d3a4412db55b2a Closes-bug: #1804842 --- .../ml2/drivers/openvswitch/agent/ovs_neutron_agent.py | 3 ++- .../ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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 ce536056185..a9bd3035541 100644 --- a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py +++ b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py @@ -345,7 +345,7 @@ class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin, # we only want to update resource versions on startup self.agent_state.pop('resource_versions', None) - if self.agent_state.pop('start_flag', None): + if self.agent_state.pop('start_flag', None) and self.iter_num == 0: # On initial start, we notify systemd after initialization # is complete. systemd.notify_once() @@ -2048,6 +2048,7 @@ class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin, self._reset_tunnel_ofports() self.setup_tunnel_br() self.setup_tunnel_br_flows() + self.agent_state['start_flag'] = True if self.enable_distributed_routing: self.dvr_agent.reset_ovs_parameters(self.int_br, self.tun_br, diff --git a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py index 88ed95e21db..1411fc33363 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py +++ b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py @@ -2068,6 +2068,10 @@ class TestOvsNeutronAgent(object): failed_devices, Exception('Fake exception to get out of the loop')] check_ovs_status.side_effect = args + + if self.agent.enable_tunneling: + self.agent.agent_state.pop("start_flag") + try: self.agent.daemon_loop() except Exception: @@ -2097,6 +2101,8 @@ class TestOvsNeutronAgent(object): self.assertTrue(reset_tunnel_ofports.called) self.assertTrue(setup_tunnel_br_flows.called) self.assertTrue(setup_tunnel_br.called) + if self.agent.enable_tunneling: + self.assertTrue(self.agent.agent_state.get('start_flag')) def test_ovs_status(self): self._test_ovs_status(constants.OVS_NORMAL,