@@ -2269,8 +2269,11 @@ def test_update_port_postcommit_live_migration_revision_mismatch_once(
22692269 '_is_port_provisioning_required' , lambda * _ : True )
22702270 @mock .patch .object (mech_driver .OVNMechanismDriver , '_notify_dhcp_updated' )
22712271 @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 ):
22742277 self .plugin .update_port_status = mock .Mock ()
22752278 self .plugin .get_port = mock .Mock (return_value = mock .MagicMock ())
22762279
@@ -2288,10 +2291,12 @@ def test_update_port_postcommit_revision_mismatch_not_after_live_migration(
22882291
22892292 fake_ctx = mock .Mock (current = fake_port , original = original_fake_port ,
22902293 _plugin_context = fake_context )
2294+
2295+ exc_params = exc_extra_params .copy ()
2296+ exc_params [resource_id_name ] = fake_port ['id' ]
2297+
22912298 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 ),
22952300 None ]
22962301
22972302 self .mech_driver .update_port_postcommit (fake_ctx )
@@ -2301,6 +2306,20 @@ def test_update_port_postcommit_revision_mismatch_not_after_live_migration(
23012306 self .assertEqual (1 , mock_update_port .call_count )
23022307 mock_notify_dhcp .assert_called_with (fake_port ['id' ])
23032308
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+
23042323 def test_agent_alive_true (self ):
23052324 chassis_private = self ._add_chassis (5 )
23062325 for agent_type in (ovn_const .OVN_CONTROLLER_AGENT ,
0 commit comments