Skip to content

Commit 0e2ef90

Browse files
authored
Merge pull request #210 from stackhpc/upstream/yoga-2025-05-12
Synchronise yoga with upstream
2 parents d985521 + 18f8a72 commit 0e2ef90

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

neutron/plugins/ml2/drivers/ovn/mech_driver/mech_driver.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,9 @@ def _ovn_update_port(self, plugin_context, port, original_port,
768768
port['revision_number'] = db_port['revision_number']
769769
self._ovn_update_port(plugin_context, port, original_port,
770770
retry_on_revision_mismatch=False)
771+
except ovn_revision_numbers_db.StandardAttributeIDNotFound:
772+
LOG.debug("Standard attribute was not found for port %s. It was "
773+
"possibly deleted concurrently.", port['id'])
771774

772775
def create_port_postcommit(self, context):
773776
"""Create a port.

neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2247,8 +2247,11 @@ def test_update_port_postcommit_live_migration_revision_mismatch_once(
22472247
'_is_port_provisioning_required', lambda *_: True)
22482248
@mock.patch.object(mech_driver.OVNMechanismDriver, '_notify_dhcp_updated')
22492249
@mock.patch.object(ovn_client.OVNClient, 'update_port')
2250-
def test_update_port_postcommit_revision_mismatch_not_after_live_migration(
2251-
self, mock_update_port, mock_notify_dhcp):
2250+
def _test_update_port_postcommit_with_exception(
2251+
self, mock_update_port, mock_notify_dhcp,
2252+
raised_exc,
2253+
resource_id_name,
2254+
**exc_extra_params):
22522255
self.plugin.update_port_status = mock.Mock()
22532256
self.plugin.get_port = mock.Mock(return_value=mock.MagicMock())
22542257

@@ -2266,10 +2269,12 @@ def test_update_port_postcommit_revision_mismatch_not_after_live_migration(
22662269

22672270
fake_ctx = mock.Mock(current=fake_port, original=original_fake_port,
22682271
_plugin_context=fake_context)
2272+
2273+
exc_params = exc_extra_params.copy()
2274+
exc_params[resource_id_name] = fake_port['id']
2275+
22692276
mock_update_port.side_effect = [
2270-
ovn_exceptions.RevisionConflict(
2271-
resource_id=fake_port['id'],
2272-
resource_type=ovn_const.TYPE_PORTS),
2277+
raised_exc(**exc_params),
22732278
None]
22742279

22752280
self.mech_driver.update_port_postcommit(fake_ctx)
@@ -2279,6 +2284,20 @@ def test_update_port_postcommit_revision_mismatch_not_after_live_migration(
22792284
self.assertEqual(1, mock_update_port.call_count)
22802285
mock_notify_dhcp.assert_called_with(fake_port['id'])
22812286

2287+
def test_update_port_postcommit_revision_mismatch_not_after_live_migration(
2288+
self):
2289+
self._test_update_port_postcommit_with_exception(
2290+
raised_exc=ovn_exceptions.RevisionConflict,
2291+
resource_id_name='resource_id',
2292+
resource_type=ovn_const.TYPE_PORTS,
2293+
)
2294+
2295+
def test__ovn_update_port_missing_stdattribute(self):
2296+
"""Make sure exception is handled."""
2297+
self._test_update_port_postcommit_with_exception(
2298+
raised_exc=ovn_revision_numbers_db.StandardAttributeIDNotFound,
2299+
resource_id_name='resource_uuid')
2300+
22822301
def test_agent_alive_true(self):
22832302
chassis_private = self._add_chassis(5)
22842303
for agent_type in (ovn_const.OVN_CONTROLLER_AGENT,

0 commit comments

Comments
 (0)