Merge "Pass instance object to soft_delete() and get_info()"

This commit is contained in:
Jenkins
2014-02-26 01:10:32 +00:00
committed by Gerrit Code Review
3 changed files with 7 additions and 5 deletions
+2 -3
View File
@@ -2105,14 +2105,13 @@ class ComputeManager(manager.Manager):
try:
self._notify_about_instance_usage(context, instance,
"soft_delete.start")
db_inst = obj_base.obj_to_primitive(instance)
try:
self.driver.soft_delete(db_inst)
self.driver.soft_delete(instance)
except NotImplementedError:
# Fallback to just powering off the instance if the
# hypervisor doesn't implement the soft_delete method
self.driver.power_off(instance)
current_power_state = self._get_power_state(context, db_inst)
current_power_state = self._get_power_state(context, instance)
instance.power_state = current_power_state
instance.vm_state = vm_states.SOFT_DELETED
instance.task_state = None
+1 -1
View File
@@ -335,7 +335,7 @@ class _VirtDriverTestCase(_FakeDriverBackendTestCase):
@catch_notimplementederror
def test_soft_delete(self):
instance_ref, network_info = self._get_running_instance()
instance_ref, network_info = self._get_running_instance(obj=True)
self.connection.soft_delete(instance_ref)
@catch_notimplementederror
+4 -1
View File
@@ -538,7 +538,10 @@ class ComputeDriver(object):
raise NotImplementedError()
def soft_delete(self, instance):
"""Soft delete the specified instance."""
"""Soft delete the specified instance.
:param instance: nova.objects.instance.Instance
"""
raise NotImplementedError()
def restore(self, instance):