virt: Remove 'post_interrupted_snapshot_cleanup' API
Change-Id: I999f93b1c99fd327774bdbd92a8e483f3a41637f Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
parent
912b717207
commit
39fe22161c
|
@ -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,
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue