From a7976b349133ce770f35e8d036eb3b5f74534c78 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Wed, 15 Jul 2020 16:31:43 +0200 Subject: [PATCH] Implement get_deploy_steps for AgentRAID This allows using software RAID as an in-band deploy step. Change-Id: I66103598cf58267010a09b1bd654dc90f714c202 --- ironic/drivers/modules/agent.py | 12 ++++++++++++ ironic/tests/unit/drivers/modules/test_agent.py | 12 ++++++++++++ releasenotes/notes/agent-raid-647acfd599e83476.yaml | 5 +++++ 3 files changed, 29 insertions(+) create mode 100644 releasenotes/notes/agent-raid-647acfd599e83476.yaml diff --git a/ironic/drivers/modules/agent.py b/ironic/drivers/modules/agent.py index 601dd7d911..9d5243533e 100644 --- a/ironic/drivers/modules/agent.py +++ b/ironic/drivers/modules/agent.py @@ -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, diff --git a/ironic/tests/unit/drivers/modules/test_agent.py b/ironic/tests/unit/drivers/modules/test_agent.py index b841ab988e..ecc734a9d4 100644 --- a/ironic/tests/unit/drivers/modules/test_agent.py +++ b/ironic/tests/unit/drivers/modules/test_agent.py @@ -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, diff --git a/releasenotes/notes/agent-raid-647acfd599e83476.yaml b/releasenotes/notes/agent-raid-647acfd599e83476.yaml new file mode 100644 index 0000000000..84248fa107 --- /dev/null +++ b/releasenotes/notes/agent-raid-647acfd599e83476.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + The ``agent`` RAID interface now supports building RAID as a deploy step + ``apply_configuration``.