Don't print traceback if standard attr is missing on update
If northd is very busy, it may happen port is deleted when handling an
LSP down event causing standard attribute being gone when bumping ovn
revision number. This is because the port is set down in SB DB first and
then northd propagates that to NB DB, and then the event is emited.
This patch just makes sure the traceback is not printed in case this
happens.
TrivialFix
Closes-bug: #2069442
Change-Id: I7d21e4adc27fab411346e0458c92191e69ce6b30
Signed-off-by: Jakub Libosvar <libosvar@redhat.com>
(cherry picked from commit 8ab385f97d
)
This commit is contained in:
parent
b09cf36e91
commit
1f761c27f2
@ -793,6 +793,9 @@ class OVNMechanismDriver(api.MechanismDriver):
|
||||
port['revision_number'] = db_port['revision_number']
|
||||
self._ovn_update_port(plugin_context, port, original_port,
|
||||
retry_on_revision_mismatch=False)
|
||||
except ovn_revision_numbers_db.StandardAttributeIDNotFound:
|
||||
LOG.debug("Standard attribute was not found for port %s. It was "
|
||||
"possibly deleted concurrently.", port['id'])
|
||||
|
||||
def create_port_postcommit(self, context):
|
||||
"""Create a port.
|
||||
|
@ -2392,8 +2392,11 @@ class TestOVNMechanismDriver(TestOVNMechanismDriverBase):
|
||||
'_is_port_provisioning_required', lambda *_: True)
|
||||
@mock.patch.object(mech_driver.OVNMechanismDriver, '_notify_dhcp_updated')
|
||||
@mock.patch.object(ovn_client.OVNClient, 'update_port')
|
||||
def test_update_port_postcommit_revision_mismatch_not_after_live_migration(
|
||||
self, mock_update_port, mock_notify_dhcp):
|
||||
def _test_update_port_postcommit_with_exception(
|
||||
self, mock_update_port, mock_notify_dhcp,
|
||||
raised_exc,
|
||||
resource_id_name,
|
||||
**exc_extra_params):
|
||||
self.plugin.update_port_status = mock.Mock()
|
||||
self.plugin.get_port = mock.Mock(return_value=mock.MagicMock())
|
||||
|
||||
@ -2411,10 +2414,12 @@ class TestOVNMechanismDriver(TestOVNMechanismDriverBase):
|
||||
|
||||
fake_ctx = mock.Mock(current=fake_port, original=original_fake_port,
|
||||
plugin_context=fake_context)
|
||||
|
||||
exc_params = exc_extra_params.copy()
|
||||
exc_params[resource_id_name] = fake_port['id']
|
||||
|
||||
mock_update_port.side_effect = [
|
||||
ovn_exceptions.RevisionConflict(
|
||||
resource_id=fake_port['id'],
|
||||
resource_type=ovn_const.TYPE_PORTS),
|
||||
raised_exc(**exc_params),
|
||||
None]
|
||||
|
||||
self.mech_driver.update_port_postcommit(fake_ctx)
|
||||
@ -2424,6 +2429,20 @@ class TestOVNMechanismDriver(TestOVNMechanismDriverBase):
|
||||
self.assertEqual(1, mock_update_port.call_count)
|
||||
mock_notify_dhcp.assert_called_with(fake_port['id'])
|
||||
|
||||
def test_update_port_postcommit_revision_mismatch_not_after_live_migration(
|
||||
self):
|
||||
self._test_update_port_postcommit_with_exception(
|
||||
raised_exc=ovn_exceptions.RevisionConflict,
|
||||
resource_id_name='resource_id',
|
||||
resource_type=ovn_const.TYPE_PORTS,
|
||||
)
|
||||
|
||||
def test__ovn_update_port_missing_stdattribute(self):
|
||||
"""Make sure exception is handled."""
|
||||
self._test_update_port_postcommit_with_exception(
|
||||
raised_exc=ovn_revision_numbers_db.StandardAttributeIDNotFound,
|
||||
resource_id_name='resource_uuid')
|
||||
|
||||
def test_agent_alive_true(self):
|
||||
chassis_private = self._add_chassis_private(5)
|
||||
for agent_type in (ovn_const.OVN_CONTROLLER_AGENT,
|
||||
|
Loading…
Reference in New Issue
Block a user