From bfea8f17b041f458e59557ebbb2f9cc50f8fdf24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aija=20Jaunt=C4=93va?= Date: Thu, 20 Jan 2022 05:56:55 -0500 Subject: [PATCH] Add idrac-wsman clean steps to not require ramdisk For BIOS factory_reset updated to use power interface as direct REBOOT call fails when system is OFF that can happen if running without ramdisk. Change-Id: I9baf13e9a089bc692e8010dc7e291d7791d1f73c --- ironic/drivers/modules/drac/bios.py | 6 +++--- ironic/drivers/modules/drac/management.py | 6 +++--- ironic/drivers/modules/drac/raid.py | 4 ++-- ironic/tests/unit/drivers/modules/drac/test_bios.py | 4 ++++ ...an-clean-steps-not-require-ramdisk-ca98aa5c0a88f727.yaml | 5 +++++ 5 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 releasenotes/notes/idrac-wsman-clean-steps-not-require-ramdisk-ca98aa5c0a88f727.yaml diff --git a/ironic/drivers/modules/drac/bios.py b/ironic/drivers/modules/drac/bios.py index 8ea3ff51f6..2ee5657686 100644 --- a/ironic/drivers/modules/drac/bios.py +++ b/ironic/drivers/modules/drac/bios.py @@ -71,7 +71,7 @@ class DracWSManBIOS(base.BIOSInterface): reason=_("Unable to import dracclient.exceptions library")) @METRICS.timer('DracWSManBIOS.apply_configuration') - @base.clean_step(priority=0, argsinfo=_args_info) + @base.clean_step(priority=0, argsinfo=_args_info, requires_ramdisk=False) @base.deploy_step(priority=0, argsinfo=_args_info) def apply_configuration(self, task, settings): """Apply the BIOS configuration to the node @@ -352,7 +352,7 @@ class DracWSManBIOS(base.BIOSInterface): manager_utils.notify_conductor_resume_deploy(task) @METRICS.timer('DracWSManBIOS.factory_reset') - @base.clean_step(priority=0) + @base.clean_step(priority=0, requires_ramdisk=False) @base.deploy_step(priority=0) def factory_reset(self, task): """Reset the BIOS settings of the node to the factory default. @@ -418,7 +418,7 @@ class DracWSManBIOS(base.BIOSInterface): node.timestamp_driver_internal_info('factory_reset_time') # rebooting the server to apply factory reset value - client.set_power_state('REBOOT') + task.driver.power.reboot(task) # This method calls node.save(), bios_config_job_id will be # saved automatically diff --git a/ironic/drivers/modules/drac/management.py b/ironic/drivers/modules/drac/management.py index f18f5e29e6..0e9284990b 100644 --- a/ironic/drivers/modules/drac/management.py +++ b/ironic/drivers/modules/drac/management.py @@ -763,7 +763,7 @@ class DracWSManManagement(base.ManagementInterface): @METRICS.timer('DracManagement.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. @@ -778,7 +778,7 @@ class DracWSManManagement(base.ManagementInterface): @METRICS.timer('DracManagement.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 the iDRAC, Clear the job queue. @@ -794,7 +794,7 @@ class DracWSManManagement(base.ManagementInterface): @METRICS.timer('DracManagement.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 the job queue. diff --git a/ironic/drivers/modules/drac/raid.py b/ironic/drivers/modules/drac/raid.py index d4e633f9c8..ae52828388 100644 --- a/ironic/drivers/modules/drac/raid.py +++ b/ironic/drivers/modules/drac/raid.py @@ -1593,7 +1593,7 @@ class DracWSManRAID(base.RAIDInterface): ), "required": False, } - }) + }, requires_ramdisk=False) def create_configuration(self, task, create_root_volume=True, create_nonroot_volumes=True, @@ -1690,7 +1690,7 @@ class DracWSManRAID(base.RAIDInterface): return _create_virtual_disks(task, node) @METRICS.timer('DracRAID.delete_configuration') - @base.clean_step(priority=0) + @base.clean_step(priority=0, requires_ramdisk=False) @base.deploy_step(priority=0) def delete_configuration(self, task): """Delete the RAID configuration. diff --git a/ironic/tests/unit/drivers/modules/drac/test_bios.py b/ironic/tests/unit/drivers/modules/drac/test_bios.py index e24267f95c..ab56fed0eb 100644 --- a/ironic/tests/unit/drivers/modules/drac/test_bios.py +++ b/ironic/tests/unit/drivers/modules/drac/test_bios.py @@ -22,6 +22,7 @@ Test class for DRAC BIOS configuration specific methods from unittest import mock from dracclient import exceptions as drac_exceptions +from oslo_utils import importutils from oslo_utils import timeutils from ironic.common import exception @@ -36,6 +37,8 @@ from ironic import objects from ironic.tests.unit.drivers.modules.drac import utils as test_utils from ironic.tests.unit.objects import utils as obj_utils +drac_constants = importutils.try_import('dracclient.constants') + INFO_DICT = test_utils.INFO_DICT @@ -73,6 +76,7 @@ class DracWSManBIOSConfigurationTestCase(test_utils.BaseDracTest): } self.mock_client.commit_pending_bios_changes.return_value = \ "JID_5678" + self.mock_client.get_power_state.return_value = drac_constants.POWER_ON @mock.patch.object(drac_common, 'parse_driver_info', autospec=True) diff --git a/releasenotes/notes/idrac-wsman-clean-steps-not-require-ramdisk-ca98aa5c0a88f727.yaml b/releasenotes/notes/idrac-wsman-clean-steps-not-require-ramdisk-ca98aa5c0a88f727.yaml new file mode 100644 index 0000000000..fa478defed --- /dev/null +++ b/releasenotes/notes/idrac-wsman-clean-steps-not-require-ramdisk-ca98aa5c0a88f727.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Adds support for ``idrac-wsman`` RAID, BIOS and management clean steps to + be run without IPA when disabling ramdisk during cleaning.