Fix OVS OVSNeutronAgent.reclaim_local_vlan()

Closes-Bug: #1957931

Change-Id: I5b716399cb8344b8a89b97378fcb4796654e6152
(cherry picked from commit d033c9f933)
This commit is contained in:
jpic 2022-01-14 16:31:22 +01:00 committed by Rodolfo Alonso Hernandez
parent 77afc56e10
commit f47fdf4d05
2 changed files with 8 additions and 1 deletions

View File

@ -1034,7 +1034,7 @@ class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin,
'''
try:
lvm = vlanmanager.LocalVlanManager().pop(net_uuid)
except KeyError:
except vlanmanager.MappingNotFound:
LOG.debug("Network %s not used on agent.", net_uuid)
return

View File

@ -2001,6 +2001,13 @@ class TestOvsNeutronAgent(object):
self.agent.reclaim_local_vlan('net1')
tun_br.cleanup_tunnel_port.assert_not_called()
with mock.patch.object(self.mod_agent.LOG, 'debug') as log_debug_fn:
self.agent.reclaim_local_vlan('net999')
log_debug_fn.assert_called_once_with(
'Network %s not used on agent.',
'net999',
)
def test_recl_lv_port_to_remove(self):
self._prepare_l2_pop_ofports()
self.agent.l2_pop = True