@@ -1254,10 +1254,12 @@ def test_delete_forced(self):
1254
1254
@mock .patch ('nova.objects.Instance.save' )
1255
1255
@mock .patch ('nova.compute.utils.notify_about_instance_usage' )
1256
1256
@mock .patch ('nova.objects.Service.get_by_compute_host' )
1257
+ @mock .patch ('nova.compute.api.API._record_action_start' )
1257
1258
@mock .patch ('nova.compute.api.API._local_delete' )
1258
1259
def test_delete_error_state_with_no_host (
1259
- self , mock_local_delete , mock_service_get , _mock_notify ,
1260
- _mock_save , mock_bdm_get , mock_lookup , _mock_del_booting ):
1260
+ self , mock_local_delete , mock_record , mock_service_get ,
1261
+ _mock_notify , _mock_save , mock_bdm_get , mock_lookup ,
1262
+ _mock_del_booting ):
1261
1263
# Instance in error state with no host should be a local delete
1262
1264
# for non API cells
1263
1265
inst = self ._create_instance_obj (params = dict (vm_state = vm_states .ERROR ,
@@ -1269,6 +1271,8 @@ def test_delete_error_state_with_no_host(
1269
1271
mock_local_delete .assert_called_once_with (
1270
1272
self .context , inst , mock_bdm_get .return_value ,
1271
1273
'delete' , self .compute_api ._do_delete )
1274
+ mock_record .assert_called_once_with (self .context , inst ,
1275
+ instance_actions .DELETE )
1272
1276
mock_terminate .assert_not_called ()
1273
1277
mock_service_get .assert_not_called ()
1274
1278
@@ -7905,8 +7909,9 @@ def test_get_all_ip6_filter_exc(self, mock_list_port, mock_check_ext):
7905
7909
@mock .patch .object (compute_utils , 'notify_about_instance_usage' )
7906
7910
@mock .patch .object (objects .BlockDeviceMapping , 'destroy' )
7907
7911
@mock .patch .object (objects .Instance , 'destroy' )
7912
+ @mock .patch ('nova.compute.api.API._record_action_start' )
7908
7913
def _test_delete_volume_backed_instance (
7909
- self , vm_state , mock_instance_destroy , bdm_destroy ,
7914
+ self , vm_state , mock_record , mock_instance_destroy , bdm_destroy ,
7910
7915
notify_about_instance_usage , mock_save , mock_elevated ,
7911
7916
bdm_get_by_instance_uuid , mock_lookup , _mock_del_booting ,
7912
7917
notify_about_instance_action ):
@@ -7935,6 +7940,8 @@ def _test_delete_volume_backed_instance(
7935
7940
'detach' ) as mock_detach :
7936
7941
self .compute_api .delete (self .context , inst )
7937
7942
7943
+ mock_record .assert_called_once_with (self .context , inst ,
7944
+ instance_actions .DELETE )
7938
7945
mock_deallocate .assert_called_once_with (self .context , inst )
7939
7946
mock_detach .assert_called_once_with (self .context , volume_id ,
7940
7947
inst .uuid )
0 commit comments