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 "
|
LOG.debug("Instance in transitional state %s at start-up "
|
||||||
"clearing task state",
|
"clearing task state",
|
||||||
instance.task_state, instance=instance)
|
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.task_state = None
|
||||||
instance.save()
|
instance.save()
|
||||||
|
|
||||||
|
@ -3973,9 +3968,6 @@ class ComputeManager(manager.Manager):
|
||||||
instance.save()
|
instance.save()
|
||||||
LOG.warning("Image not found during snapshot", instance=instance)
|
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)
|
@messaging.expected_exceptions(NotImplementedError)
|
||||||
@wrap_exception()
|
@wrap_exception()
|
||||||
def volume_snapshot_create(self, context, instance, volume_id,
|
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):
|
def _test_init_instance_cleans_image_states(self, instance):
|
||||||
with mock.patch.object(instance, 'save') as save:
|
with mock.patch.object(instance, 'save') as save:
|
||||||
self.compute._get_power_state = mock.Mock()
|
self.compute._get_power_state = mock.Mock()
|
||||||
self.compute.driver.post_interrupted_snapshot_cleanup = mock.Mock()
|
|
||||||
instance.info_cache = None
|
instance.info_cache = None
|
||||||
instance.power_state = power_state.RUNNING
|
instance.power_state = power_state.RUNNING
|
||||||
instance.host = self.compute.host
|
instance.host = self.compute.host
|
||||||
self.compute._init_instance(self.context, instance)
|
self.compute._init_instance(self.context, instance)
|
||||||
save.assert_called_once_with()
|
save.assert_called_once_with()
|
||||||
self.compute.driver.post_interrupted_snapshot_cleanup.\
|
|
||||||
assert_called_once_with(self.context, instance)
|
|
||||||
self.assertIsNone(instance.task_state)
|
self.assertIsNone(instance.task_state)
|
||||||
|
|
||||||
@mock.patch('nova.compute.manager.ComputeManager._get_power_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'],
|
self.connection.snapshot(self.ctxt, instance_ref, img_ref['id'],
|
||||||
lambda *args, **kwargs: None)
|
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
|
@catch_notimplementederror
|
||||||
def test_reboot(self):
|
def test_reboot(self):
|
||||||
reboot_type = "SOFT"
|
reboot_type = "SOFT"
|
||||||
|
|
|
@ -724,16 +724,6 @@ class ComputeDriver(object):
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError()
|
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,
|
def finish_migration(self, context, migration, instance, disk_info,
|
||||||
network_info, image_meta, resize_instance,
|
network_info, image_meta, resize_instance,
|
||||||
allocations, block_device_info=None, power_on=True):
|
allocations, block_device_info=None, power_on=True):
|
||||||
|
|
Loading…
Reference in New Issue