Merge "Not set instance to ERROR if set_admin_password failed"
This commit is contained in:
commit
6feed9ae84
|
@ -3655,7 +3655,6 @@ class ComputeManager(manager.Manager):
|
||||||
except Exception:
|
except Exception:
|
||||||
# Catch all here because this could be anything.
|
# Catch all here because this could be anything.
|
||||||
LOG.exception('set_admin_password failed', instance=instance)
|
LOG.exception('set_admin_password failed', instance=instance)
|
||||||
self._set_instance_obj_error_state(context, instance)
|
|
||||||
# We create a new exception here so that we won't
|
# We create a new exception here so that we won't
|
||||||
# potentially reveal password information to the
|
# potentially reveal password information to the
|
||||||
# API caller. The real exception is logged above
|
# API caller. The real exception is logged above
|
||||||
|
|
|
@ -3749,14 +3749,9 @@ class ComputeManagerUnitTestCase(test.NoDBTestCase):
|
||||||
instance=instance,
|
instance=instance,
|
||||||
new_pass=None)
|
new_pass=None)
|
||||||
|
|
||||||
if (expected_exception == exception.SetAdminPasswdNotSupported or
|
if expected_exception != exception.InstancePasswordSetFailed:
|
||||||
expected_exception == exception.InstanceAgentNotEnabled or
|
|
||||||
expected_exception == NotImplementedError):
|
|
||||||
instance_save_mock.assert_called_once_with(
|
instance_save_mock.assert_called_once_with(
|
||||||
expected_task_state=task_states.UPDATING_PASSWORD)
|
expected_task_state=task_states.UPDATING_PASSWORD)
|
||||||
else:
|
|
||||||
# setting the instance to error state
|
|
||||||
instance_save_mock.assert_called_once_with()
|
|
||||||
|
|
||||||
self.assertEqual(expected_vm_state, instance.vm_state)
|
self.assertEqual(expected_vm_state, instance.vm_state)
|
||||||
# check revert_task_state decorator
|
# check revert_task_state decorator
|
||||||
|
@ -3774,7 +3769,7 @@ class ComputeManagerUnitTestCase(test.NoDBTestCase):
|
||||||
exc = exception.Forbidden('Internal error')
|
exc = exception.Forbidden('Internal error')
|
||||||
expected_exception = exception.InstancePasswordSetFailed
|
expected_exception = exception.InstancePasswordSetFailed
|
||||||
self._do_test_set_admin_password_driver_error(
|
self._do_test_set_admin_password_driver_error(
|
||||||
exc, vm_states.ERROR, None, expected_exception)
|
exc, vm_states.ACTIVE, None, expected_exception)
|
||||||
|
|
||||||
def test_set_admin_password_driver_not_implemented(self):
|
def test_set_admin_password_driver_not_implemented(self):
|
||||||
# Ensure expected exception is raised if set_admin_password not
|
# Ensure expected exception is raised if set_admin_password not
|
||||||
|
|
Loading…
Reference in New Issue