Merge "If rescue failed set instance to ERROR"

This commit is contained in:
Jenkins 2015-10-06 14:49:40 +00:00 committed by Gerrit Code Review
commit f00d76b111
2 changed files with 3 additions and 3 deletions

View File

@ -3283,6 +3283,7 @@ class ComputeManager(manager.Manager):
except Exception as e:
LOG.exception(_LE("Error trying to Rescue Instance"),
instance=instance)
self._set_instance_obj_error_state(context, instance)
raise exception.InstanceNotRescuable(
instance_id=instance.uuid,
reason=_("Driver Error: %s") % e)

View File

@ -2208,7 +2208,7 @@ class ComputeTestCase(BaseTestCase):
self.compute.terminate_instance(self.context, instance, [], [])
def test_rescue_handle_err(self):
# If the driver fails to rescue, instance state should remain the same
# If the driver fails to rescue, instance state should got to ERROR
# and the exception should be converted to InstanceNotRescuable
inst_obj = self._create_fake_instance_obj()
self.mox.StubOutWithMock(self.compute, '_get_rescue_image')
@ -2224,7 +2224,6 @@ class ComputeTestCase(BaseTestCase):
expected_message = ('Instance %s cannot be rescued: '
'Driver Error: Try again later' % inst_obj.uuid)
inst_obj.vm_state = 'some_random_state'
with testtools.ExpectedException(
exception.InstanceNotRescuable, expected_message):
@ -2233,7 +2232,7 @@ class ComputeTestCase(BaseTestCase):
rescue_password='password', rescue_image_ref=None,
clean_shutdown=True)
self.assertEqual('some_random_state', inst_obj.vm_state)
self.assertEqual(vm_states.ERROR, inst_obj.vm_state)
@mock.patch.object(image_api.API, "get")
@mock.patch.object(nova.virt.fake.FakeDriver, "rescue")