Browse Source

Merge "Use driver_internal_info methods for ilo driver"

changes/11/823311/3
Zuul 4 months ago committed by Gerrit Code Review
parent
commit
b600cb8b5f
  1. 20
      ironic/drivers/modules/ilo/bios.py
  2. 28
      ironic/drivers/modules/ilo/boot.py
  3. 8
      ironic/drivers/modules/ilo/common.py
  4. 22
      ironic/drivers/modules/ilo/management.py
  5. 24
      ironic/drivers/modules/ilo/raid.py

20
ironic/drivers/modules/ilo/bios.py

@ -100,13 +100,11 @@ class IloBIOS(base.BIOSInterface):
deploy_utils.set_async_step_flags(node, reboot=True,
skip_current_step=False)
driver_internal_info = node.driver_internal_info
if step == 'apply_configuration':
driver_internal_info['apply_bios'] = True
node.set_driver_internal_info('apply_bios', True)
else:
driver_internal_info['reset_bios'] = True
node.set_driver_internal_info('reset_bios', True)
node.driver_internal_info = driver_internal_info
node.save()
return return_state
@ -122,11 +120,9 @@ class IloBIOS(base.BIOSInterface):
"""
node = task.node
driver_internal_info = node.driver_internal_info
driver_internal_info.pop('apply_bios', None)
driver_internal_info.pop('reset_bios', None)
task.node.driver_internal_info = driver_internal_info
task.node.save()
node.del_driver_internal_info('apply_bios')
node.del_driver_internal_info('reset_bios')
node.save()
if step not in ('apply_configuration', 'factory_reset'):
errmsg = (_('Could not find the step %(step)s for the '
@ -174,11 +170,10 @@ class IloBIOS(base.BIOSInterface):
"""
node = task.node
driver_internal_info = node.driver_internal_info
data = {}
for setting in settings:
data.update({setting['name']: setting['value']})
if not driver_internal_info.get('apply_bios'):
if not node.driver_internal_info.get('apply_bios'):
return self._execute_pre_boot_bios_step(
task, 'apply_configuration', data)
else:
@ -198,9 +193,8 @@ class IloBIOS(base.BIOSInterface):
"""
node = task.node
driver_internal_info = node.driver_internal_info
if not driver_internal_info.get('reset_bios'):
if not node.driver_internal_info.get('reset_bios'):
return self._execute_pre_boot_bios_step(task, 'factory_reset')
else:
return self._execute_post_boot_bios_step(task, 'factory_reset')

28
ironic/drivers/modules/ilo/boot.py

@ -288,9 +288,7 @@ def prepare_node_for_deploy(task):
# not provided.
# Since secure boot was disabled, we are in 'uefi' boot mode.
if boot_mode_utils.get_boot_mode_for_deploy(task.node) is None:
driver_internal_info = task.node.driver_internal_info
driver_internal_info['deploy_boot_mode'] = 'uefi'
task.node.driver_internal_info = driver_internal_info
task.node.set_driver_internal_info('deploy_boot_mode', 'uefi')
task.node.save()
@ -458,9 +456,7 @@ class IloVirtualMediaBoot(base.BootInterface):
# It will set iSCSI info onto iLO
if boot_mode == 'uefi':
# Need to set 'ilo_uefi_iscsi_boot' param for clean up
driver_internal_info = task.node.driver_internal_info
driver_internal_info['ilo_uefi_iscsi_boot'] = True
task.node.driver_internal_info = driver_internal_info
task.node.set_driver_internal_info('ilo_uefi_iscsi_boot', True)
task.node.save()
task.driver.management.set_iscsi_boot_target(task)
manager_utils.node_set_boot_device(
@ -516,9 +512,7 @@ class IloVirtualMediaBoot(base.BootInterface):
and task.node.driver_internal_info.get('ilo_uefi_iscsi_boot')):
# It will clear iSCSI info from iLO
task.driver.management.clear_iscsi_boot_target(task)
driver_internal_info = task.node.driver_internal_info
driver_internal_info.pop('ilo_uefi_iscsi_boot', None)
task.node.driver_internal_info = driver_internal_info
task.node.del_driver_internal_info('ilo_uefi_iscsi_boot')
task.node.save()
else:
image_utils.cleanup_iso_image(task)
@ -626,9 +620,7 @@ class IloPXEBoot(pxe.PXEBoot):
# Need to enable secure boot, if being requested
boot_mode_utils.configure_secure_boot_if_needed(task)
# Need to set 'ilo_uefi_iscsi_boot' param for clean up
driver_internal_info = task.node.driver_internal_info
driver_internal_info['ilo_uefi_iscsi_boot'] = True
task.node.driver_internal_info = driver_internal_info
task.node.set_driver_internal_info('ilo_uefi_iscsi_boot', True)
task.node.save()
# It will set iSCSI info onto iLO
task.driver.management.set_iscsi_boot_target(task)
@ -654,7 +646,6 @@ class IloPXEBoot(pxe.PXEBoot):
:raises: IloOperationError, if some operation on iLO failed.
"""
manager_utils.node_power_action(task, states.POWER_OFF)
driver_internal_info = task.node.driver_internal_info
if (deploy_utils.is_iscsi_boot(task)
and task.node.driver_internal_info.get('ilo_uefi_iscsi_boot')):
@ -662,8 +653,7 @@ class IloPXEBoot(pxe.PXEBoot):
# It will clear iSCSI info from iLO in case of booting from
# volume in UEFI boot mode
task.driver.management.clear_iscsi_boot_target(task)
driver_internal_info.pop('ilo_uefi_iscsi_boot', None)
task.node.driver_internal_info = driver_internal_info
task.node.del_driver_internal_info('ilo_uefi_iscsi_boot')
task.node.save()
else:
# Volume boot in BIOS boot mode is handled using
@ -723,9 +713,7 @@ class IloiPXEBoot(ipxe.iPXEBoot):
# Need to enable secure boot, if being requested
boot_mode_utils.configure_secure_boot_if_needed(task)
# Need to set 'ilo_uefi_iscsi_boot' param for clean up
driver_internal_info = task.node.driver_internal_info
driver_internal_info['ilo_uefi_iscsi_boot'] = True
task.node.driver_internal_info = driver_internal_info
task.node.set_driver_internal_info('ilo_uefi_iscsi_boot', True)
task.node.save()
# It will set iSCSI info onto iLO
task.driver.management.set_iscsi_boot_target(task)
@ -751,7 +739,6 @@ class IloiPXEBoot(ipxe.iPXEBoot):
:raises: IloOperationError, if some operation on iLO failed.
"""
manager_utils.node_power_action(task, states.POWER_OFF)
driver_internal_info = task.node.driver_internal_info
if (deploy_utils.is_iscsi_boot(task)
and task.node.driver_internal_info.get('ilo_uefi_iscsi_boot')):
@ -759,8 +746,7 @@ class IloiPXEBoot(ipxe.iPXEBoot):
# It will clear iSCSI info from iLO in case of booting from
# volume in UEFI boot mode
task.driver.management.clear_iscsi_boot_target(task)
driver_internal_info.pop('ilo_uefi_iscsi_boot', None)
task.node.driver_internal_info = driver_internal_info
task.node.del_driver_internal_info('ilo_uefi_iscsi_boot')
task.node.save()
else:
# Volume boot in BIOS boot mode is handled using

8
ironic/drivers/modules/ilo/common.py

@ -637,9 +637,7 @@ def update_boot_mode(task):
# No boot mode found. Check if default_boot_mode is defined
if not boot_mode and (CONF.ilo.default_boot_mode in ['bios', 'uefi']):
boot_mode = CONF.ilo.default_boot_mode
driver_internal_info = node.driver_internal_info
driver_internal_info['deploy_boot_mode'] = boot_mode
node.driver_internal_info = driver_internal_info
node.set_driver_internal_info('deploy_boot_mode', boot_mode)
node.save()
# Boot mode is computed, setting it for the deploy
@ -679,9 +677,7 @@ def update_boot_mode(task):
"as pending boot mode is unknown.",
{'uuid': node.uuid, 'boot_mode': boot_mode})
driver_internal_info = node.driver_internal_info
driver_internal_info['deploy_boot_mode'] = boot_mode
node.driver_internal_info = driver_internal_info
node.set_driver_internal_info('deploy_boot_mode', boot_mode)
node.save()

22
ironic/drivers/modules/ilo/management.py

@ -951,17 +951,13 @@ class IloManagement(base.ManagementInterface):
class Ilo5Management(IloManagement):
def _set_driver_internal_value(self, task, value, *keys):
driver_internal_info = task.node.driver_internal_info
for key in keys:
driver_internal_info[key] = value
task.node.driver_internal_info = driver_internal_info
task.node.set_driver_internal_info(key, value)
task.node.save()
def _pop_driver_internal_values(self, task, *keys):
driver_internal_info = task.node.driver_internal_info
for key in keys:
driver_internal_info.pop(key, None)
task.node.driver_internal_info = driver_internal_info
task.node.del_driver_internal_info(key)
task.node.save()
def _wait_for_disk_erase_status(self, node):
@ -1041,7 +1037,6 @@ class Ilo5Management(IloManagement):
{'hdd': 'overwrite', 'ssd': 'block'})
node = task.node
self._validate_erase_pattern(erase_pattern, node)
driver_internal_info = node.driver_internal_info
LOG.debug("Calling out-of-band sanitize disk erase for node %(node)s",
{'node': node.uuid})
try:
@ -1056,7 +1051,7 @@ class Ilo5Management(IloManagement):
# First disk-erase will execute for HDD's and after reboot only
# try for SSD, since both share same redfish api and would be
# overwritten.
if not driver_internal_info.get(
if not node.driver_internal_info.get(
'ilo_disk_erase_hdd_check') and ('HDD' in disk_types):
ilo_object.do_disk_erase('HDD', erase_pattern.get('hdd'))
self._set_driver_internal_value(
@ -1066,7 +1061,7 @@ class Ilo5Management(IloManagement):
task, False, 'skip_current_clean_step')
return deploy_utils.reboot_to_finish_step(task)
if not driver_internal_info.get(
if not node.driver_internal_info.get(
'ilo_disk_erase_ssd_check') and ('SSD' in disk_types):
ilo_object.do_disk_erase('SSD', erase_pattern.get('ssd'))
self._set_driver_internal_value(
@ -1145,14 +1140,12 @@ class Ilo5Management(IloManagement):
:raises: InstanceDeployFailure, on failure to execute of deploy step.
"""
node = task.node
driver_internal_info = node.driver_internal_info
if driver_internal_info.get('clear_ca_certs_flag'):
if node.driver_internal_info.get('clear_ca_certs_flag'):
# NOTE(vmud213): Clear the flag and do nothing as this flow
# is part of the reboot required by the clean step that is
# already executed.
driver_internal_info.pop('clear_ca_certs_flag', None)
node.driver_internal_info = driver_internal_info
node.del_driver_internal_info('clear_ca_certs_flag')
node.save()
return
@ -1167,8 +1160,7 @@ class Ilo5Management(IloManagement):
raise exception.NodeCleaningFailure(msg)
raise exception.InstanceDeployFailure(msg)
driver_internal_info['clear_ca_certs_flag'] = True
node.driver_internal_info = driver_internal_info
node.set_driver_internal_info('clear_ca_certs_flag', True)
node.save()
deploy_opts = deploy_utils.build_agent_options(task.node)

24
ironic/drivers/modules/ilo/raid.py

@ -78,24 +78,18 @@ class Ilo5RAID(base.RAIDInterface):
manager_utils.cleaning_error_handler(task, log_msg, errmsg=msg)
def _set_driver_internal_true_value(self, task, *keys):
driver_internal_info = task.node.driver_internal_info
for key in keys:
driver_internal_info[key] = True
task.node.driver_internal_info = driver_internal_info
task.node.set_driver_internal_info(key, True)
task.node.save()
def _set_driver_internal_false_value(self, task, *keys):
driver_internal_info = task.node.driver_internal_info
for key in keys:
driver_internal_info[key] = False
task.node.driver_internal_info = driver_internal_info
task.node.set_driver_internal_info(key, False)
task.node.save()
def _pop_driver_internal_values(self, task, *keys):
driver_internal_info = task.node.driver_internal_info
for key in keys:
driver_internal_info.pop(key, None)
task.node.driver_internal_info = driver_internal_info
task.node.del_driver_internal_info(key)
task.node.save()
def _prepare_for_read_raid(self, task, raid_step):
@ -157,9 +151,8 @@ class Ilo5RAID(base.RAIDInterface):
target_raid_config = raid.filter_target_raid_config(
node, create_root_volume=create_root_volume,
create_nonroot_volumes=create_nonroot_volumes)
driver_internal_info = node.driver_internal_info
driver_internal_info['target_raid_config'] = target_raid_config
node.driver_internal_info = driver_internal_info
node.set_driver_internal_info('target_raid_config',
target_raid_config)
node.save()
LOG.debug("Calling OOB RAID create_configuration for node %(node)s "
"with the following target RAID configuration: %(target)s",
@ -168,7 +161,8 @@ class Ilo5RAID(base.RAIDInterface):
try:
# Raid configuration in progress, checking status
if not driver_internal_info.get('ilo_raid_create_in_progress'):
if not node.driver_internal_info.get(
'ilo_raid_create_in_progress'):
ilo_object.create_raid_configuration(target_raid_config)
self._prepare_for_read_raid(task, 'create_raid')
return deploy_utils.get_async_step_return_state(node)
@ -221,12 +215,12 @@ class Ilo5RAID(base.RAIDInterface):
node = task.node
LOG.debug("OOB RAID delete_configuration invoked for node %s.",
node.uuid)
driver_internal_info = node.driver_internal_info
ilo_object = ilo_common.get_ilo_object(node)
try:
# Raid configuration in progress, checking status
if not driver_internal_info.get('ilo_raid_delete_in_progress'):
if not node.driver_internal_info.get(
'ilo_raid_delete_in_progress'):
ilo_object.delete_raid_configuration()
self._prepare_for_read_raid(task, 'delete_raid')
return deploy_utils.get_async_step_return_state(node)

Loading…
Cancel
Save