Keep original error message when cleaning tear down fails

Currenty we set last_error to ""Failed to tear down from cleaning for node".
This change adds a real reason to it for simpler debugging.

Change-Id: I57866c00f4b75cd7de8d4080716a26dea9f63759
This commit is contained in:
Dmitry Tantsur 2016-06-06 17:18:05 +02:00
parent d5184813f5
commit 86a9897769
2 changed files with 6 additions and 4 deletions

View File

@ -1003,8 +1003,9 @@ class ConductorManager(base_manager.BaseConductorManager):
try:
task.driver.deploy.tear_down_cleaning(task)
except Exception as e:
msg = (_('Failed to tear down from cleaning for node %s')
% node.uuid)
msg = (_('Failed to tear down from cleaning for node %(node)s, '
'reason: %(err)s')
% {'node': node.uuid, 'err': e})
LOG.exception(msg)
return utils.cleaning_error_handler(task, msg,
tear_down_cleaning=False)

View File

@ -2058,7 +2058,7 @@ class DoNodeCleanTestCase(mgr_utils.ServiceSetUpMixin,
deploy_exec_mock.return_value = None
power_exec_mock.return_value = None
tear_mock.side_effect = Exception()
tear_mock.side_effect = Exception('boom')
self._start_service()
@ -2088,7 +2088,8 @@ class DoNodeCleanTestCase(mgr_utils.ServiceSetUpMixin,
]
self.assertEqual(power_exec_calls, power_exec_mock.call_args_list)
log_mock.exception.assert_called_once_with(
'Failed to tear down from cleaning for node {}'.format(node.uuid))
'Failed to tear down from cleaning for node {}, reason: boom'
.format(node.uuid))
def test__do_next_clean_step_automated_fail_in_tear_down_cleaning(self):
self._do_next_clean_step_fail_in_tear_down_cleaning()