summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Alvares Gomes <lucasagomes@gmail.com>2015-11-20 16:03:02 +0000
committerZhenguo Niu <niuzhenguo@huawei.com>2016-01-16 17:16:47 +0800
commit9877f12d5a683a12975a6619ee5c3cd68a3541a7 (patch)
tree48425898ca6992c41673148c1d1b8aa5465b88bc
parent1443d4d94448b3f04ecb2d0fbd9ba189ba8dcb44 (diff)
downloadironic-9877f12d5a683a12975a6619ee5c3cd68a3541a7.tar.gz
Fix: Next cleaning hangs if the previous cleaning was aborted
When cleaning is abort Ironic leaves the node's clean_step field populated with the step that was running at the moment. Because of that, once the next cleaning starts again (after the node have been moved to "manageable" and in the transition to "available") it will hang and never finish, the reason for that is because once the node starts heartbeating again Ironic won't know if the cleaning just started or it's just continuing cleaning (it uses clean_step as a flag for it, see the bug linked with this patch). This patch fix this by cleaning up the node's clean_field once the cleaning process is aborted. Closes-Bug: #1518374 Change-Id: I423e89f9574a8952875ad9f03ce33298cb5660e7 (cherry picked from commit a8070a59233895ce1c7b6f92ef88cc31bc729188)
-rw-r--r--ironic/conductor/manager.py1
-rw-r--r--ironic/tests/conductor/test_manager.py2
2 files changed, 3 insertions, 0 deletions
diff --git a/ironic/conductor/manager.py b/ironic/conductor/manager.py
index 2bf83747a..b4bee3161 100644
--- a/ironic/conductor/manager.py
+++ b/ironic/conductor/manager.py
@@ -1123,6 +1123,7 @@ class ConductorManager(periodic_task.PeriodicTasks):
info_message += msg
node.last_error = last_error
+ node.clean_step = None
node.save()
LOG.info(info_message)
diff --git a/ironic/tests/conductor/test_manager.py b/ironic/tests/conductor/test_manager.py
index 3651397aa..9907da370 100644
--- a/ironic/tests/conductor/test_manager.py
+++ b/ironic/tests/conductor/test_manager.py
@@ -1588,6 +1588,8 @@ class DoNodeDeployTearDownTestCase(_ServiceSetUpMixin,
tear_mock.assert_called_once_with(task.driver.deploy, task)
if step_name:
self.assertIn(step_name, task.node.last_error)
+ # assert node's clean_step was cleaned up
+ self.assertEqual({}, task.node.clean_step)
def test__do_node_clean_abort(self):
self._test__do_node_clean_abort(None)