@@ -2247,8 +2247,11 @@ def test_update_port_postcommit_live_migration_revision_mismatch_once(
2247
2247
'_is_port_provisioning_required' , lambda * _ : True )
2248
2248
@mock .patch .object (mech_driver .OVNMechanismDriver , '_notify_dhcp_updated' )
2249
2249
@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 ):
2252
2255
self .plugin .update_port_status = mock .Mock ()
2253
2256
self .plugin .get_port = mock .Mock (return_value = mock .MagicMock ())
2254
2257
@@ -2266,10 +2269,12 @@ def test_update_port_postcommit_revision_mismatch_not_after_live_migration(
2266
2269
2267
2270
fake_ctx = mock .Mock (current = fake_port , original = original_fake_port ,
2268
2271
_plugin_context = fake_context )
2272
+
2273
+ exc_params = exc_extra_params .copy ()
2274
+ exc_params [resource_id_name ] = fake_port ['id' ]
2275
+
2269
2276
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 ),
2273
2278
None ]
2274
2279
2275
2280
self .mech_driver .update_port_postcommit (fake_ctx )
@@ -2279,6 +2284,20 @@ def test_update_port_postcommit_revision_mismatch_not_after_live_migration(
2279
2284
self .assertEqual (1 , mock_update_port .call_count )
2280
2285
mock_notify_dhcp .assert_called_with (fake_port ['id' ])
2281
2286
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
+
2282
2301
def test_agent_alive_true (self ):
2283
2302
chassis_private = self ._add_chassis (5 )
2284
2303
for agent_type in (ovn_const .OVN_CONTROLLER_AGENT ,
0 commit comments