From 5938fa9b46df2e4a4d0a317bec1b442195041b9e Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Fri, 7 Dec 2018 16:38:13 -0500 Subject: [PATCH] Drop old service version check compat from _delete_while_booting Like change I11083aa3c78bd8b6201558561457f3d65007a177 the API should not need to have compatibility code for mitaka-era services, so this drops the service version check from the _delete_while_booting method. Change-Id: I26d58e8156b209c26d01da0baf7137d33eda4307 --- nova/compute/api.py | 11 ----------- nova/tests/unit/compute/test_compute.py | 21 --------------------- nova/tests/unit/compute/test_compute_api.py | 12 ------------ 3 files changed, 44 deletions(-) diff --git a/nova/compute/api.py b/nova/compute/api.py index 25075d7c9635..8cf7a52a0bcc 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -1815,17 +1815,6 @@ class API(base.Base): need to be looked up in a cell db and the normal delete path taken. """ deleted = self._attempt_delete_of_buildrequest(context, instance) - - # After service version 15 deletion of the BuildRequest will halt the - # build process in the conductor. In that case run the rest of this - # method and consider the instance deleted. If we have not yet reached - # service version 15 then just return False so the rest of the delete - # process will proceed usually. - service_version = objects.Service.get_minimum_version( - context, 'nova-osapi_compute') - if service_version < 15: - return False - if deleted: # If we've reached this block the successful deletion of the # buildrequest indicates that the build process should be halted by diff --git a/nova/tests/unit/compute/test_compute.py b/nova/tests/unit/compute/test_compute.py index 370033468d94..8b85ad8ab3cc 100644 --- a/nova/tests/unit/compute/test_compute.py +++ b/nova/tests/unit/compute/test_compute.py @@ -8304,27 +8304,6 @@ class ComputeTestCase(BaseTestCase, legacy_notify, notify, instance.uuid, self.compute_api.notifier, self.context) - @mock.patch('nova.compute.utils.notify_about_instance_action') - @mock.patch('nova.objects.Instance.destroy') - @mock.patch('nova.objects.Service.get_minimum_version') - @mock.patch('nova.compute.utils.notify_about_instance_usage') - @mock.patch('nova.objects.BuildRequest.get_by_instance_uuid') - def test_delete_while_booting_instance_not_in_cell_db_cellsv1( - self, br_get_by_instance, legacy_notify, minimum_server_version, - instance_destroy, notify): - - minimum_server_version.return_value = 14 - - instance = self._create_fake_instance_obj() - instance.host = None - instance.save() - - self.compute_api._delete_instance(self.context, instance) - - test_utils.assert_instance_delete_notification_by_uuid( - legacy_notify, notify, instance.uuid, self.compute_api.notifier, - self.context) - @mock.patch('nova.compute.utils.notify_about_instance_action') @mock.patch('nova.objects.Instance.destroy') @mock.patch('nova.objects.InstanceMapping.get_by_instance_uuid') diff --git a/nova/tests/unit/compute/test_compute_api.py b/nova/tests/unit/compute/test_compute_api.py index 0bb1ccd101b5..3701c78158d2 100644 --- a/nova/tests/unit/compute/test_compute_api.py +++ b/nova/tests/unit/compute/test_compute_api.py @@ -1667,18 +1667,6 @@ class _ComputeAPIUnitTestMixIn(object): inst)) self.assertTrue(build_req_mock.destroy.called) - @mock.patch.object(objects.Service, 'get_minimum_version', return_value=0) - def test_delete_while_booting_low_service_version(self, - mock_get_service_version): - inst = self._create_instance_obj() - with mock.patch.object(self.compute_api, - '_attempt_delete_of_buildrequest') as mock_attempt_delete: - self.assertFalse( - self.compute_api._delete_while_booting(self.context, inst)) - self.assertTrue(mock_attempt_delete.called) - mock_get_service_version.assert_called_once_with(self.context, - 'nova-osapi_compute') - def test_delete_while_booting_buildreq_not_deleted(self): self.useFixture(nova_fixtures.AllServicesCurrent()) inst = self._create_instance_obj()