Browse Source

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
(cherry picked from commit ae031d1886)
changes/99/623499/1
Slawek Kaplonski 4 years ago
parent
commit
ae2ef68140
  1. 3
      neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py
  2. 6
      neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py

3
neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py

@ -330,7 +330,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()
@ -2033,6 +2033,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,

6
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,

Loading…
Cancel
Save