Allow running RAID cleaning steps with in-band cleaning
In I3b647e39982c0a98abac7b0a7c1c60215d6db4f2, the change allowed users to set priorities for create and delete config however it was not set in the right place because the steps live in the `raid` interface. This patch introduces a get_clean_steps for the RAID interface which gets all the steps and the correct overrides. This has been tested to work in a local environment. Change-Id: I5138ec9daf27affc28647dd83c79a867c9be6f3d
This commit is contained in:
parent
f5dc3a0698
commit
8cfde74470
@ -666,6 +666,24 @@ class AgentRAID(base.RAIDInterface):
|
||||
"""Return the properties of the interface."""
|
||||
return {}
|
||||
|
||||
@METRICS.timer('AgentRAID.get_clean_steps')
|
||||
def get_clean_steps(self, task):
|
||||
"""Get the list of clean steps from the agent.
|
||||
|
||||
:param task: a TaskManager object containing the node
|
||||
:raises NodeCleaningFailure: if the clean steps are not yet
|
||||
available (cached), for example, when a node has just been
|
||||
enrolled and has not been cleaned yet.
|
||||
:returns: A list of clean step dictionaries
|
||||
"""
|
||||
new_priorities = {
|
||||
'delete_configuration': CONF.deploy.delete_configuration_priority,
|
||||
'create_configuration': CONF.deploy.create_configuration_priority
|
||||
}
|
||||
return agent_base.get_steps(
|
||||
task, 'clean', interface='raid',
|
||||
override_priorities=new_priorities)
|
||||
|
||||
@METRICS.timer('AgentRAID.get_deploy_steps')
|
||||
def get_deploy_steps(self, task):
|
||||
"""Get the list of deploy steps from the agent.
|
||||
|
@ -852,8 +852,6 @@ class AgentDeployMixin(HeartbeatMixin, AgentOobStepsMixin):
|
||||
'erase_devices': CONF.deploy.erase_devices_priority,
|
||||
'erase_devices_metadata':
|
||||
CONF.deploy.erase_devices_metadata_priority,
|
||||
'delete_configuration': CONF.deploy.delete_configuration_priority,
|
||||
'create_configuration': CONF.deploy.create_configuration_priority
|
||||
}
|
||||
return get_steps(
|
||||
task, 'clean', interface='deploy',
|
||||
|
@ -1163,21 +1163,16 @@ class TestAgentDeploy(db_base.DbTestCase):
|
||||
mock_get_steps.assert_called_once_with(
|
||||
task, 'clean', interface='deploy',
|
||||
override_priorities={'erase_devices': None,
|
||||
'erase_devices_metadata': None,
|
||||
'delete_configuration': None,
|
||||
'create_configuration': None})
|
||||
'erase_devices_metadata': None})
|
||||
self.assertEqual(mock_steps, steps)
|
||||
|
||||
@mock.patch.object(agent_base, 'get_steps', autospec=True)
|
||||
def test_get_clean_steps_config_priority(self, mock_get_steps):
|
||||
# Test that we can override the priority of get clean steps
|
||||
# Use 0 because it is an edge case (false-y) and used in devstack
|
||||
# for erase_devices, and 42 for RAID cleaning steps as they are
|
||||
# disabled by default.
|
||||
# for erase_devices.
|
||||
self.config(erase_devices_priority=0, group='deploy')
|
||||
self.config(erase_devices_metadata_priority=0, group='deploy')
|
||||
self.config(delete_configuration_priority=42, group='deploy')
|
||||
self.config(create_configuration_priority=42, group='deploy')
|
||||
mock_steps = [{'priority': 10, 'interface': 'deploy',
|
||||
'step': 'erase_devices'}]
|
||||
mock_get_steps.return_value = mock_steps
|
||||
@ -1186,9 +1181,7 @@ class TestAgentDeploy(db_base.DbTestCase):
|
||||
mock_get_steps.assert_called_once_with(
|
||||
task, 'clean', interface='deploy',
|
||||
override_priorities={'erase_devices': 0,
|
||||
'erase_devices_metadata': 0,
|
||||
'delete_configuration': 42,
|
||||
'create_configuration': 42})
|
||||
'erase_devices_metadata': 0})
|
||||
|
||||
@mock.patch.object(deploy_utils, 'prepare_inband_cleaning', autospec=True)
|
||||
def test_prepare_cleaning(self, prepare_inband_cleaning_mock):
|
||||
@ -1763,8 +1756,22 @@ class AgentRAIDTestCase(db_base.DbTestCase):
|
||||
with task_manager.acquire(self.context, self.node.uuid) as task:
|
||||
ret = task.driver.raid.get_clean_steps(task)
|
||||
|
||||
self.assertEqual(0, ret[0]['priority'])
|
||||
self.assertEqual(0, ret[1]['priority'])
|
||||
self.assertEqual(1, ret[0]['priority'])
|
||||
self.assertEqual(2, ret[1]['priority'])
|
||||
|
||||
@mock.patch.object(agent_base, 'get_steps', autospec=True)
|
||||
def test_get_clean_steps_config_priority(self, get_steps_mock):
|
||||
# Test that we can override the priority of get clean steps
|
||||
# Use 0 because it is an edge case (false-y) and used in devstack
|
||||
# for erase_devices.
|
||||
self.config(create_configuration_priority=50, group='deploy')
|
||||
self.config(delete_configuration_priority=40, group='deploy')
|
||||
with task_manager.acquire(self.context, self.node.uuid) as task:
|
||||
task.driver.raid.get_clean_steps(task)
|
||||
get_steps_mock.assert_called_once_with(
|
||||
task, 'clean', interface='raid',
|
||||
override_priorities={'create_configuration': 50,
|
||||
'delete_configuration': 40})
|
||||
|
||||
@mock.patch.object(agent_base, 'get_steps', autospec=True)
|
||||
def test_get_deploy_steps(self, get_steps_mock):
|
||||
|
@ -980,9 +980,7 @@ class ISCSIDeployTestCase(db_base.DbTestCase):
|
||||
task, 'clean', interface='deploy',
|
||||
override_priorities={
|
||||
'erase_devices': 10,
|
||||
'erase_devices_metadata': 5,
|
||||
'delete_configuration': None,
|
||||
'create_configuration': None})
|
||||
'erase_devices_metadata': 5})
|
||||
self.assertEqual(mock_steps, steps)
|
||||
|
||||
@mock.patch.object(agent_base, 'execute_step', autospec=True)
|
||||
|
Loading…
Reference in New Issue
Block a user