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
This commit is contained in:
Matt Riedemann 2018-12-07 16:38:13 -05:00
parent 63a32c230c
commit 5938fa9b46
3 changed files with 0 additions and 44 deletions

View File

@ -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

View File

@ -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')

View File

@ -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()