Merge "ovs: fix regression when vlan mapping is not already registered" into stable/zed

This commit is contained in:
Zuul 2023-03-10 16:09:54 +00:00 committed by Gerrit Code Review
commit 8c5127b809
2 changed files with 12 additions and 0 deletions

View File

@ -504,6 +504,9 @@ class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin,
LOG.warning("Can't update segmentation id on no uniq segment "
"for a network %s", network['id'])
return
except vlanmanager.MappingNotFound:
LOG.debug("Mapping not found for network %s", network['id'])
return
if segmentation_id_old is None:
# The segmentation id did not changed.

View File

@ -2717,6 +2717,15 @@ class TestOvsNeutronAgent(object):
self.agent._update_network_segmentation_id(network)
mock_get.assert_not_called()
def test__update_network_segmentation_id_mapping_not_found(self):
network = {'id': 'my-net-uuid',
'segments': [mock.ANY]}
with mock.patch.object(self.agent.vlan_manager,
'get') as mock_get:
mock_get.side_effect = ValueError
self.assertIsNone(
self.agent._update_network_segmentation_id(network))
def _test_treat_smartnic_port(self, vif_type):
vm_uuid = "407a79e0-e0be-4b7d-92a6-513b2161011b"
iface_id = "407a79e0-e0be-4b7d-92a6-513b2161011c"