summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Rollenhagen <jim@jimrollenhagen.com>2015-11-23 22:40:19 +0000
committerJim Rollenhagen <jim@jimrollenhagen.com>2015-12-03 07:13:17 -0800
commit6eb970b71cb6ae629b733ced84917d9db5afc78a (patch)
tree88e39fc837372a345002a6464d05161a45710b76
parente9aafe57d35e34f8f0d30a8ee1617124f47758c8 (diff)
downloadironic-6eb970b71cb6ae629b733ced84917d9db5afc78a.tar.gz
Fix bug where clean steps do not run4.2.2
A bug was introduced during Liberty where Ironic transparently ignores all clean steps and finishes cleaning. This is caused by _get_node_next_clean_steps returning an empty list when cleaning has just started. Fix this method to return the full list of clean steps when cleaning begins. This may leave previous tenants' data on disk and available to future tenants. Deployers should apply this patch (or upgrade to a new release with this patch) ASAP. Closes-Bug: #1517277 (cherry picked from commit 1c700e6d62ad299e3fc9023e30b98d51408e49e1) Change-Id: If815f81d7e668244f0d434d4e2933e8f41946107
-rw-r--r--ironic/conductor/manager.py5
-rw-r--r--ironic/tests/conductor/test_manager.py14
-rw-r--r--releasenotes/notes/fix-clean-steps-not-running-0d065cb022bc0419.yaml11
3 files changed, 28 insertions, 2 deletions
diff --git a/ironic/conductor/manager.py b/ironic/conductor/manager.py
index ed5c1c090..2bf83747a 100644
--- a/ironic/conductor/manager.py
+++ b/ironic/conductor/manager.py
@@ -840,10 +840,11 @@ class ConductorManager(periodic_task.PeriodicTasks):
"""
node = task.node
+ next_steps = node.driver_internal_info.get('clean_steps', [])
if not node.clean_step:
- return []
+ # first time through, return all steps
+ return next_steps
- next_steps = node.driver_internal_info.get('clean_steps', [])
try:
# Trim off the last clean step (now finished) and
# all previous steps
diff --git a/ironic/tests/conductor/test_manager.py b/ironic/tests/conductor/test_manager.py
index 13f4cdcd4..3651397aa 100644
--- a/ironic/tests/conductor/test_manager.py
+++ b/ironic/tests/conductor/test_manager.py
@@ -2150,6 +2150,20 @@ class DoNodeCleanTestCase(_ServiceSetUpMixin, tests_db_base.DbTestCase):
steps = self.service._get_node_next_clean_steps(task)
self.assertEqual(self.next_clean_steps, steps)
+ def test__get_node_next_clean_steps_unset_clean_step(self):
+ driver_internal_info = {'clean_steps': self.clean_steps}
+ node = obj_utils.create_test_node(
+ self.context, driver='fake',
+ provision_state=states.CLEANWAIT,
+ target_provision_state=states.AVAILABLE,
+ driver_internal_info=driver_internal_info,
+ last_error=None,
+ clean_step=None)
+
+ with task_manager.acquire(self.context, node.uuid) as task:
+ steps = self.service._get_node_next_clean_steps(task)
+ self.assertEqual(self.clean_steps, steps)
+
def test__get_node_next_clean_steps_bad_clean_step(self):
driver_internal_info = {'clean_steps': self.clean_steps}
node = obj_utils.create_test_node(
diff --git a/releasenotes/notes/fix-clean-steps-not-running-0d065cb022bc0419.yaml b/releasenotes/notes/fix-clean-steps-not-running-0d065cb022bc0419.yaml
new file mode 100644
index 000000000..2ef966a18
--- /dev/null
+++ b/releasenotes/notes/fix-clean-steps-not-running-0d065cb022bc0419.yaml
@@ -0,0 +1,11 @@
+---
+prelude: >
+ A major bug was fixed where clean steps do not run.
+critical:
+ - This fixes a bug where Ironic skipped all clean steps,
+ which may leave the previous tenant's data on disk
+ available to new users.
+security:
+ - This fixes a bug where Ironic skipped all clean steps,
+ which may leave the previous tenant's data on disk
+ available to new users.