Implement get_deploy_steps for AgentRAID

This allows using software RAID as an in-band deploy step.

Change-Id: I66103598cf58267010a09b1bd654dc90f714c202
This commit is contained in:
Dmitry Tantsur 2020-07-15 16:31:43 +02:00
parent 079b22a800
commit a7976b3491
3 changed files with 29 additions and 0 deletions

View File

@ -622,6 +622,18 @@ class AgentRAID(base.RAIDInterface):
"""Return the properties of the interface."""
return {}
@METRICS.timer('AgentRAID.get_deploy_steps')
def get_deploy_steps(self, task):
"""Get the list of deploy steps from the agent.
:param task: a TaskManager object containing the node
:raises InstanceDeployFailure: if the deploy steps are not yet
available (cached), for example, when a node has just been
enrolled and has not been deployed yet.
:returns: A list of deploy step dictionaries
"""
return agent_base.get_steps(task, 'deploy', interface='raid')
@METRICS.timer('AgentRAID.create_configuration')
@base.clean_step(priority=0)
def create_configuration(self, task,

View File

@ -1649,6 +1649,18 @@ class AgentRAIDTestCase(db_base.DbTestCase):
self.assertEqual(0, ret[0]['priority'])
self.assertEqual(0, ret[1]['priority'])
@mock.patch.object(agent_base, 'get_steps', autospec=True)
def test_get_deploy_steps(self, get_steps_mock):
get_steps_mock.return_value = [
{'step': 'apply_configuration', 'interface': 'raid',
'priority': 0},
]
with task_manager.acquire(self.context, self.node.uuid) as task:
ret = task.driver.raid.get_deploy_steps(task)
self.assertEqual('apply_configuration', ret[0]['step'])
@mock.patch.object(raid, 'filter_target_raid_config', autospec=True)
@mock.patch.object(agent_base, 'execute_step', autospec=True)
def test_create_configuration(self, execute_mock,

View File

@ -0,0 +1,5 @@
---
features:
- |
The ``agent`` RAID interface now supports building RAID as a deploy step
``apply_configuration``.