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
(cherry picked from commit cf96bd8bdf
)
This commit is contained in:
parent
ee28d85db9
commit
44cd883728
|
@ -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.
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue