diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 8aeefa65d2..b2de71ccdd 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -1027,11 +1027,6 @@ class ComputeManager(manager.Manager): LOG.debug("Instance in transitional state %s at start-up " "clearing task state", instance.task_state, instance=instance) - try: - self._post_interrupted_snapshot_cleanup(context, instance) - except Exception: - # we don't want that an exception blocks the init_host - LOG.exception('Failed to cleanup snapshot.', instance=instance) instance.task_state = None instance.save() @@ -3973,9 +3968,6 @@ class ComputeManager(manager.Manager): instance.save() LOG.warning("Image not found during snapshot", instance=instance) - def _post_interrupted_snapshot_cleanup(self, context, instance): - self.driver.post_interrupted_snapshot_cleanup(context, instance) - @messaging.expected_exceptions(NotImplementedError) @wrap_exception() def volume_snapshot_create(self, context, instance, volume_id, diff --git a/nova/tests/unit/compute/test_compute_mgr.py b/nova/tests/unit/compute/test_compute_mgr.py index a1cda2d017..ddd9866a7d 100644 --- a/nova/tests/unit/compute/test_compute_mgr.py +++ b/nova/tests/unit/compute/test_compute_mgr.py @@ -1762,14 +1762,11 @@ class ComputeManagerUnitTestCase(test.NoDBTestCase, def _test_init_instance_cleans_image_states(self, instance): with mock.patch.object(instance, 'save') as save: self.compute._get_power_state = mock.Mock() - self.compute.driver.post_interrupted_snapshot_cleanup = mock.Mock() instance.info_cache = None instance.power_state = power_state.RUNNING instance.host = self.compute.host self.compute._init_instance(self.context, instance) save.assert_called_once_with() - self.compute.driver.post_interrupted_snapshot_cleanup.\ - assert_called_once_with(self.context, instance) self.assertIsNone(instance.task_state) @mock.patch('nova.compute.manager.ComputeManager._get_power_state', diff --git a/nova/tests/unit/virt/test_virt_drivers.py b/nova/tests/unit/virt/test_virt_drivers.py index 6c582ff0a5..051c865294 100644 --- a/nova/tests/unit/virt/test_virt_drivers.py +++ b/nova/tests/unit/virt/test_virt_drivers.py @@ -252,12 +252,6 @@ class _VirtDriverTestCase(_FakeDriverBackendTestCase): self.connection.snapshot(self.ctxt, instance_ref, img_ref['id'], lambda *args, **kwargs: None) - @catch_notimplementederror - def test_post_interrupted_snapshot_cleanup(self): - instance_ref, network_info = self._get_running_instance() - self.connection.post_interrupted_snapshot_cleanup(self.ctxt, - instance_ref) - @catch_notimplementederror def test_reboot(self): reboot_type = "SOFT" diff --git a/nova/virt/driver.py b/nova/virt/driver.py index a5d71dd882..5a1f4d2d4a 100644 --- a/nova/virt/driver.py +++ b/nova/virt/driver.py @@ -724,16 +724,6 @@ class ComputeDriver(object): """ raise NotImplementedError() - # TODO(stephenfin): This was only implemented (properly) for XenAPI and - # should be removed. - def post_interrupted_snapshot_cleanup(self, context, instance): - """Cleans up any resources left after an interrupted snapshot. - - :param context: security context - :param instance: nova.objects.instance.Instance - """ - pass - def finish_migration(self, context, migration, instance, disk_info, network_info, image_meta, resize_instance, allocations, block_device_info=None, power_on=True):