Check if port exists in ``update_port_virtual_type`` method
During the OVN DB inconsistency check, a OVN LSP could not be present in the Neutron DB. In this case, continue processing other LSPs and let other ``DBInconsistenciesPeriodics`` methods to resolve this issue. Closes-Bug: #1999517 Change-Id: Ifb8bdccf6819f7f8af1abd3b82ccb1cd2e4c2fb8
This commit is contained in:
parent
f0d35679b9
commit
dfe69472a8
|
@ -849,7 +849,11 @@ class DBInconsistenciesPeriodics(SchemaAwarePeriodicsBase):
|
|||
if lsp.type != '':
|
||||
continue
|
||||
|
||||
port = self._ovn_client._plugin.get_port(context, lsp.name)
|
||||
try:
|
||||
port = self._ovn_client._plugin.get_port(context, lsp.name)
|
||||
except n_exc.PortNotFound:
|
||||
continue
|
||||
|
||||
for ip in port.get('fixed_ips', []):
|
||||
if utils.get_virtual_port_parents(
|
||||
self._nb_idl, ip['ip_address'], port['network_id'],
|
||||
|
|
|
@ -784,10 +784,13 @@ class TestDBInconsistenciesPeriodics(testlib_api.SqlTestCaseLight,
|
|||
attrs={'name': 'lsp0', 'type': ''})
|
||||
lsp1 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
|
||||
attrs={'name': 'lsp1', 'type': constants.LSP_TYPE_VIRTUAL})
|
||||
lsp2 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
|
||||
attrs={'name': 'lsp2_not_present_in_neutron_db', 'type': ''})
|
||||
port0 = {'fixed_ips': [{'ip_address': mock.ANY}],
|
||||
'network_id': mock.ANY, 'id': mock.ANY}
|
||||
nb_idl.lsp_list.return_value.execute.return_value = (lsp0, lsp1)
|
||||
self.fake_ovn_client._plugin.get_port.return_value = port0
|
||||
nb_idl.lsp_list.return_value.execute.return_value = (lsp0, lsp1, lsp2)
|
||||
self.fake_ovn_client._plugin.get_port.side_effect = [
|
||||
port0, n_exc.PortNotFound(port_id=mock.ANY)]
|
||||
|
||||
self.assertRaises(
|
||||
periodics.NeverAgain, self.periodic.update_port_virtual_type)
|
||||
|
|
Loading…
Reference in New Issue