ovs agent: signal to plugin if tunnel refresh needed

Patch https://review.opendev.org/#/c/697655/ cannot be backported
because it includes an RPC version change. This patch is for the
stable branches.

Currently the ovs agent calls update_device_list with the
agent_restarted flag set only on the first loop iteration. Then the
server knows to send the l2pop flooding entries for the network to
the agent. But when a compute node with many instances on many
networks reboots, it takes time to readd all the active devices and
some may be readded after the first loop iteration. Then the server
can fail to send the flooding entries which means there will be no
flood_to_tuns flow and broadcasts like dhcp will fail.

This patch fixes that by also setting the agent_restarted flag if
the agent has not received the flooding entries for a network.

Change-Id: Iccc4fe4a785ee042fd76a663d0e76a27facd1809
Closes-Bug: #1853613
(cherry picked from commit bc0ab0fcd7)
(cherry picked from commit aee87e72b1)
This commit is contained in:
Darragh O'Reilly 2020-01-24 16:19:30 +00:00 committed by Vlad Gusev
parent fd136826a4
commit d1e2b840b5
1 changed files with 6 additions and 1 deletions

View File

@ -908,6 +908,7 @@ class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin,
devices_up = []
devices_down = []
failed_devices = []
tunnels_missing = False
port_names = [p['vif_port'].port_name for p in need_binding_ports]
port_info = self.int_br.get_ports_attributes(
"Port", columns=["name", "tag"], ports=port_names, if_exists=True)
@ -942,6 +943,10 @@ class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin,
if port_detail.get('admin_state_up'):
LOG.debug("Setting status for %s to UP", device)
devices_up.append(device)
if (not tunnels_missing and
lvm.network_type in constants.TUNNEL_NETWORK_TYPES and
len(lvm.tun_ofports) == 0):
tunnels_missing = True
else:
LOG.debug("Setting status for %s to DOWN", device)
devices_down.append(device)
@ -951,7 +956,7 @@ class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin,
# to notify the agent to refresh the tunnel related flows.
# Otherwise, these flows will be cleaned as stale due to the
# different cookie id.
agent_restarted = self.iter_num == 0
agent_restarted = (self.iter_num == 0) or tunnels_missing
devices_set = self.plugin_rpc.update_device_list(
self.context, devices_up, devices_down, self.agent_id,
self.conf.host, agent_restarted=agent_restarted)