summaryrefslogtreecommitdiff
path: root/ironic/drivers/modules/agent.py
diff options
context:
space:
mode:
authorShivanand Tendulker <stendulker@gmail.com>2020-07-21 12:46:10 -0400
committerShivanand Tendulker <stendulker@gmail.com>2020-07-23 13:19:10 -0400
commita5ce4dd8d0b6cc383a5c82ef622cde12c16b2918 (patch)
tree7d9c7d5eff26569477870c2ee1a15eaebbee0d19 /ironic/drivers/modules/agent.py
parentd867488e90dfe0ff09c35223a842f2407dad1a75 (diff)
downloadironic-a5ce4dd8d0b6cc383a5c82ef622cde12c16b2918.tar.gz
Adds raid validation for in-band AgentRAID deploy step
This commit adds support for validation of raid configuration of in-band AgentRAID deploy step 'apply_configuration' and adds a post deploy hook to update root device hint. Change-Id: I52c1ad3e10d9fab3c2366d40af39667a299eb774
Diffstat (limited to 'ironic/drivers/modules/agent.py')
-rw-r--r--ironic/drivers/modules/agent.py52
1 files changed, 47 insertions, 5 deletions
diff --git a/ironic/drivers/modules/agent.py b/ironic/drivers/modules/agent.py
index 9d5243533..08eaf0266 100644
--- a/ironic/drivers/modules/agent.py
+++ b/ironic/drivers/modules/agent.py
@@ -59,6 +59,21 @@ OPTIONAL_PROPERTIES = {
'``image_https_proxy`` are not specified. Optional.'),
}
+_RAID_APPLY_CONFIGURATION_ARGSINFO = {
+ "raid_config": {
+ "description": "The RAID configuration to apply.",
+ "required": True,
+ },
+ "delete_existing": {
+ "description": (
+ "Setting this to 'True' indicates to delete existing RAID "
+ "configuration prior to creating the new configuration. "
+ "Default value is 'True'."
+ ),
+ "required": False,
+ }
+}
+
COMMON_PROPERTIES = REQUIRED_PROPERTIES.copy()
COMMON_PROPERTIES.update(OPTIONAL_PROPERTIES)
COMMON_PROPERTIES.update(agent_base.VENDOR_PROPERTIES)
@@ -634,6 +649,25 @@ class AgentRAID(base.RAIDInterface):
"""
return agent_base.get_steps(task, 'deploy', interface='raid')
+ @METRICS.timer('AgentRAID.apply_configuration')
+ @base.deploy_step(priority=0,
+ argsinfo=_RAID_APPLY_CONFIGURATION_ARGSINFO)
+ def apply_configuration(self, task, raid_config,
+ delete_existing=True):
+ """Applies RAID configuration on the given node.
+
+ :param task: A TaskManager instance.
+ :param raid_config: The RAID configuration to apply.
+ :param delete_existing: Setting this to True indicates to delete RAID
+ configuration prior to creating the new configuration.
+ :raises: InvalidParameterValue, if the RAID configuration is invalid.
+ :returns: states.DEPLOYWAIT if RAID configuration is in progress
+ asynchronously or None if it is complete.
+ """
+ self.validate_raid_config(task, raid_config)
+ step = task.node.deploy_step
+ return agent_base.execute_step(task, step, 'deploy')
+
@METRICS.timer('AgentRAID.create_configuration')
@base.clean_step(priority=0)
def create_configuration(self, task,
@@ -682,6 +716,8 @@ class AgentRAID(base.RAIDInterface):
@staticmethod
@agent_base.post_clean_step_hook(
interface='raid', step='create_configuration')
+ @agent_base.post_deploy_step_hook(
+ interface='raid', step='apply_configuration')
def _create_configuration_final(task, command):
"""Clean step hook after a RAID configuration was created.
@@ -699,15 +735,21 @@ class AgentRAID(base.RAIDInterface):
the 'command' argument passed.
"""
try:
- clean_result = command['command_result']['clean_result']
+ if task.node.provision_state == states.DEPLOYWAIT:
+ operation = "deploying"
+ result = command['command_result']['deploy_result']
+ else:
+ operation = "cleaning"
+ result = command['command_result']['clean_result']
except KeyError:
raise exception.IronicException(
_("Agent ramdisk didn't return a proper command result while "
- "cleaning %(node)s. It returned '%(result)s' after command "
- "execution.") % {'node': task.node.uuid,
- 'result': command})
+ "%(operation)s %(node)s. It returned '%(result)s' after "
+ "command execution.") % {'operation': operation,
+ 'node': task.node.uuid,
+ 'result': command})
- raid.update_raid_info(task.node, clean_result)
+ raid.update_raid_info(task.node, result)
@METRICS.timer('AgentRAID.delete_configuration')
@base.clean_step(priority=0)