Add idrac-redfish clean steps to not require ramdisk

Includes idrac-redfish RAID and management steps.

Update helper utility to not prepare agent on reboots
if cleaning without it.

Change-Id: I3c06e12f82908fba2b2587d0e3bec4b8bbdeba4b
This commit is contained in:
Aija Jauntēva 2022-01-20 11:51:47 -05:00
parent c65cbb7aef
commit 69e6152ac3
5 changed files with 32 additions and 9 deletions

View File

@ -1422,7 +1422,10 @@ def reboot_to_finish_step(task):
:returns: states.CLEANWAIT if cleaning operation in progress
or states.DEPLOYWAIT if deploy operation in progress.
"""
prepare_agent_boot(task)
disable_ramdisk = task.node.driver_internal_info.get(
'cleaning_disable_ramdisk')
if not disable_ramdisk:
prepare_agent_boot(task)
manager_utils.node_power_action(task, states.REBOOT)
return get_async_step_return_state(task.node)

View File

@ -362,7 +362,8 @@ class DracRedfishManagement(redfish_management.RedfishManagement):
**IMPORT_CONFIGURATION_ARGSINFO}
@base.deploy_step(priority=0, argsinfo=EXPORT_CONFIGURATION_ARGSINFO)
@base.clean_step(priority=0, argsinfo=EXPORT_CONFIGURATION_ARGSINFO)
@base.clean_step(priority=0, argsinfo=EXPORT_CONFIGURATION_ARGSINFO,
requires_ramdisk=False)
def export_configuration(self, task, export_configuration_location):
"""Export the configuration of the server.
@ -410,7 +411,8 @@ class DracRedfishManagement(redfish_management.RedfishManagement):
{'node': task.node.uuid}))
@base.deploy_step(priority=0, argsinfo=IMPORT_CONFIGURATION_ARGSINFO)
@base.clean_step(priority=0, argsinfo=IMPORT_CONFIGURATION_ARGSINFO)
@base.clean_step(priority=0, argsinfo=IMPORT_CONFIGURATION_ARGSINFO,
requires_ramdisk=False)
def import_configuration(self, task, import_configuration_location):
"""Import and apply the configuration to the server.
@ -456,7 +458,8 @@ class DracRedfishManagement(redfish_management.RedfishManagement):
return deploy_utils.reboot_to_finish_step(task)
@base.clean_step(priority=0,
argsinfo=IMPORT_EXPORT_CONFIGURATION_ARGSINFO)
argsinfo=IMPORT_EXPORT_CONFIGURATION_ARGSINFO,
requires_ramdisk=False)
@base.deploy_step(priority=0,
argsinfo=IMPORT_EXPORT_CONFIGURATION_ARGSINFO)
def import_export_configuration(self, task, import_configuration_location,
@ -611,7 +614,7 @@ class DracRedfishManagement(redfish_management.RedfishManagement):
@METRICS.timer('DracRedfishManagement.clear_job_queue')
@base.verify_step(priority=0)
@base.clean_step(priority=0)
@base.clean_step(priority=0, requires_ramdisk=False)
def clear_job_queue(self, task):
"""Clear iDRAC job queue.
@ -625,7 +628,7 @@ class DracRedfishManagement(redfish_management.RedfishManagement):
@METRICS.timer('DracRedfishManagement.reset_idrac')
@base.verify_step(priority=0)
@base.clean_step(priority=0)
@base.clean_step(priority=0, requires_ramdisk=False)
def reset_idrac(self, task):
"""Reset the iDRAC.
@ -641,7 +644,7 @@ class DracRedfishManagement(redfish_management.RedfishManagement):
@METRICS.timer('DracRedfishManagement.known_good_state')
@base.verify_step(priority=0)
@base.clean_step(priority=0)
@base.clean_step(priority=0, requires_ramdisk=False)
def known_good_state(self, task):
"""Reset iDRAC to known good state.

View File

@ -27,6 +27,7 @@ import tenacity
from ironic.common import exception
from ironic.common.i18n import _
from ironic.common import raid as raid_common
from ironic.common import states
from ironic.conductor import periodics
from ironic.conductor import utils as manager_utils
from ironic.conf import CONF
@ -1171,6 +1172,13 @@ def _wait_till_realtime_ready(task):
:raises RedfishError: If can't find OEM extension or it fails to
execute
"""
# If running without IPA, check that system is ON, if not, turn it on
disable_ramdisk = task.node.driver_internal_info.get(
'cleaning_disable_ramdisk')
power_state = task.driver.power.get_power_state(task)
if disable_ramdisk and power_state == states.POWER_OFF:
task.driver.power.set_power_state(task, states.POWER_ON)
try:
_retry_till_realtime_ready(task)
except tenacity.RetryError:
@ -1238,7 +1246,7 @@ class DracRedfishRAID(redfish_raid.RedfishRAID):
),
'required': False,
}
})
}, requires_ramdisk=False)
def create_configuration(self, task, create_root_volume=True,
create_nonroot_volumes=True,
delete_existing=False):
@ -1267,7 +1275,7 @@ class DracRedfishRAID(redfish_raid.RedfishRAID):
task, create_root_volume, create_nonroot_volumes,
delete_existing)
@base.clean_step(priority=0)
@base.clean_step(priority=0, requires_ramdisk=False)
@base.deploy_step(priority=0)
def delete_configuration(self, task):
"""Delete RAID configuration on the node.

View File

@ -2286,8 +2286,12 @@ class DracRedfishRAIDTestCase(test_utils.BaseDracTest):
@mock.patch.object(drac_raid, '_retry_till_realtime_ready', autospec=True)
def test__wait_till_realtime_ready(self, mock_ready):
self.node.set_driver_internal_info('cleaning_disable_ramdisk', True)
task = mock.Mock(node=self.node, context=self.context)
task.driver.power.get_power_state.return_value = states.POWER_OFF
drac_raid._wait_till_realtime_ready(task)
task.driver.power.set_power_state.assert_called_once_with(
task, states.POWER_ON)
mock_ready.assert_called_once_with(task)
@mock.patch.object(drac_raid, 'LOG', autospec=True)

View File

@ -0,0 +1,5 @@
---
features:
- |
Adds support for ``idrac-redfish`` RAID and management clean steps to be
run without IPA when disabling ramdisk during cleaning.