From bc0ab0fcd721d3fb01fd83291269a586f50efa0e Mon Sep 17 00:00:00 2001 From: Darragh O'Reilly Date: Fri, 24 Jan 2020 16:19:30 +0000 Subject: [PATCH] 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 --- .../ml2/drivers/openvswitch/agent/ovs_neutron_agent.py | 7 ++++++- 1 file changed, 6 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 cf7507a43ce..a99576db94f 100644 --- a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py +++ b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py @@ -1128,6 +1128,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) @@ -1162,6 +1163,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) @@ -1171,7 +1176,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)