ovs: fix regression when vlan mapping is not already registered
Bug introduced by Ic3c147136549b17aea0fe78e930a41a5b33ab9d8, when a VLAN mapping is not registered during a call to update_network_segement, the function should return None. Closes-Bug: #2009215 Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@industrialdiscipline.com> Change-Id: I91f8e8bd18d9956216e5715c658dfb408a2cbf07
This commit is contained in:
parent
0a214b0437
commit
cf96bd8bdf
|
@ -507,6 +507,9 @@ class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin,
|
||||||
LOG.warning("Can't update segmentation id on no uniq segment "
|
LOG.warning("Can't update segmentation id on no uniq segment "
|
||||||
"for a network %s", network['id'])
|
"for a network %s", network['id'])
|
||||||
return
|
return
|
||||||
|
except vlanmanager.MappingNotFound:
|
||||||
|
LOG.debug("Mapping not found for network %s", network['id'])
|
||||||
|
return
|
||||||
|
|
||||||
if segmentation_id_old is None:
|
if segmentation_id_old is None:
|
||||||
# The segmentation id did not changed.
|
# The segmentation id did not changed.
|
||||||
|
|
|
@ -2725,6 +2725,15 @@ class TestOvsNeutronAgent(object):
|
||||||
self.agent._update_network_segmentation_id(network)
|
self.agent._update_network_segmentation_id(network)
|
||||||
mock_get.assert_not_called()
|
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):
|
def _test_treat_smartnic_port(self, vif_type):
|
||||||
vm_uuid = "407a79e0-e0be-4b7d-92a6-513b2161011b"
|
vm_uuid = "407a79e0-e0be-4b7d-92a6-513b2161011b"
|
||||||
iface_id = "407a79e0-e0be-4b7d-92a6-513b2161011c"
|
iface_id = "407a79e0-e0be-4b7d-92a6-513b2161011c"
|
||||||
|
|
Loading…
Reference in New Issue