@@ -2269,8 +2269,11 @@ def test_update_port_postcommit_live_migration_revision_mismatch_once(
2269
2269
'_is_port_provisioning_required' , lambda * _ : True )
2270
2270
@mock .patch .object (mech_driver .OVNMechanismDriver , '_notify_dhcp_updated' )
2271
2271
@mock .patch .object (ovn_client .OVNClient , 'update_port' )
2272
- def test_update_port_postcommit_revision_mismatch_not_after_live_migration (
2273
- self , mock_update_port , mock_notify_dhcp ):
2272
+ def _test_update_port_postcommit_with_exception (
2273
+ self , mock_update_port , mock_notify_dhcp ,
2274
+ raised_exc ,
2275
+ resource_id_name ,
2276
+ ** exc_extra_params ):
2274
2277
self .plugin .update_port_status = mock .Mock ()
2275
2278
self .plugin .get_port = mock .Mock (return_value = mock .MagicMock ())
2276
2279
@@ -2288,10 +2291,12 @@ def test_update_port_postcommit_revision_mismatch_not_after_live_migration(
2288
2291
2289
2292
fake_ctx = mock .Mock (current = fake_port , original = original_fake_port ,
2290
2293
_plugin_context = fake_context )
2294
+
2295
+ exc_params = exc_extra_params .copy ()
2296
+ exc_params [resource_id_name ] = fake_port ['id' ]
2297
+
2291
2298
mock_update_port .side_effect = [
2292
- ovn_exceptions .RevisionConflict (
2293
- resource_id = fake_port ['id' ],
2294
- resource_type = ovn_const .TYPE_PORTS ),
2299
+ raised_exc (** exc_params ),
2295
2300
None ]
2296
2301
2297
2302
self .mech_driver .update_port_postcommit (fake_ctx )
@@ -2301,6 +2306,20 @@ def test_update_port_postcommit_revision_mismatch_not_after_live_migration(
2301
2306
self .assertEqual (1 , mock_update_port .call_count )
2302
2307
mock_notify_dhcp .assert_called_with (fake_port ['id' ])
2303
2308
2309
+ def test_update_port_postcommit_revision_mismatch_not_after_live_migration (
2310
+ self ):
2311
+ self ._test_update_port_postcommit_with_exception (
2312
+ raised_exc = ovn_exceptions .RevisionConflict ,
2313
+ resource_id_name = 'resource_id' ,
2314
+ resource_type = ovn_const .TYPE_PORTS ,
2315
+ )
2316
+
2317
+ def test__ovn_update_port_missing_stdattribute (self ):
2318
+ """Make sure exception is handled."""
2319
+ self ._test_update_port_postcommit_with_exception (
2320
+ raised_exc = ovn_revision_numbers_db .StandardAttributeIDNotFound ,
2321
+ resource_id_name = 'resource_uuid' )
2322
+
2304
2323
def test_agent_alive_true (self ):
2305
2324
chassis_private = self ._add_chassis (5 )
2306
2325
for agent_type in (ovn_const .OVN_CONTROLLER_AGENT ,
0 commit comments