Browse Source

Merge "Remove a pause before cleaning when fast-tracking" into stable/wallaby

changes/05/789805/1
Zuul 1 week ago
committed by Gerrit Code Review
parent
commit
7910d440e3
5 changed files with 35 additions and 7 deletions
  1. +12
    -1
      ironic/drivers/modules/agent_base.py
  2. +2
    -3
      ironic/drivers/modules/deploy_utils.py
  3. +12
    -0
      ironic/tests/unit/drivers/modules/test_agent.py
  4. +4
    -3
      ironic/tests/unit/drivers/modules/test_deploy_utils.py
  5. +5
    -0
      releasenotes/notes/fast-track-opt-d50eab2cc58fddcb.yaml

+ 12
- 1
ironic/drivers/modules/agent_base.py View File

@ -716,6 +716,13 @@ class AgentBaseMixin(object):
"""Whether agent boot is managed by ironic."""
return True
def refresh_steps(self, task, step_type):
"""Refresh the node's cached steps.
:param task: a TaskManager instance
:param step_type: "clean" or "deploy"
"""
@METRICS.timer('AgentBaseMixin.tear_down')
@task_manager.require_exclusive_lock
def tear_down(self, task):
@ -776,8 +783,12 @@ class AgentBaseMixin(object):
has an invalid value.
:returns: states.CLEANWAIT to signify an asynchronous prepare
"""
return deploy_utils.prepare_inband_cleaning(
result = deploy_utils.prepare_inband_cleaning(
task, manage_boot=self.should_manage_boot(task))
if result is None:
# Fast-track, ensure the steps are available.
self.refresh_steps(task, 'clean')
return result
@METRICS.timer('AgentDeployMixin.tear_down_cleaning')
def tear_down_cleaning(self, task):


+ 2
- 3
ironic/drivers/modules/deploy_utils.py View File

@ -691,9 +691,8 @@ def prepare_inband_cleaning(task, manage_boot=True):
fast_track = manager_utils.is_fast_track(task)
if not fast_track:
manager_utils.node_power_action(task, states.REBOOT)
# Tell the conductor we are waiting for the agent to boot.
return states.CLEANWAIT
# Tell the conductor we are waiting for the agent to boot.
return states.CLEANWAIT
def tear_down_inband_cleaning(task, manage_boot=True):


+ 12
- 0
ironic/tests/unit/drivers/modules/test_agent.py View File

@ -1203,6 +1203,18 @@ class TestAgentDeploy(db_base.DbTestCase):
prepare_inband_cleaning_mock.assert_called_once_with(
task, manage_boot=False)
@mock.patch.object(agent.AgentDeploy, 'refresh_steps', autospec=True)
@mock.patch.object(deploy_utils, 'prepare_inband_cleaning', autospec=True)
def test_prepare_cleaning_fast_track(self, prepare_inband_cleaning_mock,
refresh_steps_mock):
prepare_inband_cleaning_mock.return_value = None
with task_manager.acquire(self.context, self.node.uuid) as task:
self.assertIsNone(self.driver.prepare_cleaning(task))
prepare_inband_cleaning_mock.assert_called_once_with(
task, manage_boot=True)
refresh_steps_mock.assert_called_once_with(
self.driver, task, 'clean')
@mock.patch.object(deploy_utils, 'tear_down_inband_cleaning',
autospec=True)
def test_tear_down_cleaning(self, tear_down_cleaning_mock):


+ 4
- 3
ironic/tests/unit/drivers/modules/test_deploy_utils.py View File

@ -1148,15 +1148,16 @@ class AgentMethodsTestCase(db_base.DbTestCase):
is_fast_track_mock.return_value = fast_track
with task_manager.acquire(
self.context, self.node.uuid, shared=False) as task:
self.assertEqual(
states.CLEANWAIT,
utils.prepare_inband_cleaning(task, manage_boot=manage_boot))
result = utils.prepare_inband_cleaning(task,
manage_boot=manage_boot)
add_cleaning_network_mock.assert_called_once_with(
task.driver.network, task)
if not fast_track:
self.assertEqual(states.CLEANWAIT, result)
power_mock.assert_called_once_with(task, states.REBOOT)
else:
self.assertFalse(power_mock.called)
self.assertIsNone(result)
self.assertEqual(1, task.node.driver_internal_info[
'agent_erase_devices_iterations'])
self.assertIs(True, task.node.driver_internal_info[


+ 5
- 0
releasenotes/notes/fast-track-opt-d50eab2cc58fddcb.yaml View File

@ -0,0 +1,5 @@
---
fixes:
- |
Removes unnecessary delay before the start of the cleaning process when
fast-track is used.

Loading…
Cancel
Save