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 17991a8c410..279f662e002 100644 --- a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py +++ b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py @@ -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. diff --git a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py index 06efeabcf42..6ce4558d834 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py +++ b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py @@ -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"