Cache firwmare components on the transition to "manageable"

Automated cleaning is not guaranteed to be enabled, and in any case it's
too late to cache the components at that point: firwmare upgrades may
happen before the transition to "available".

Change-Id: I6b74970fffcc150c167830bef195f284a8c6f197
(cherry picked from commit 607b8734e4)
This commit is contained in:
Dmitry Tantsur 2023-12-14 09:49:27 +01:00 committed by Iury Gregory Melo Ferreira
parent e9dd47e2d9
commit 5c1f85835e
4 changed files with 29 additions and 14 deletions

View File

@ -82,11 +82,8 @@ def do_node_clean(task, clean_steps=None, disable_ramdisk=False):
disable_ramdisk)
task.node.save()
# Retrieve BIOS config settings for this node
utils.node_cache_bios_settings(task, node)
utils.node_update_cache(task)
# Retrieve Firmware Components for this node if possible
utils.node_cache_firmware_components(task)
# Allow the deploy driver to set up the ramdisk again (necessary for
# IPA cleaning)
try:

View File

@ -1441,18 +1441,18 @@ def store_agent_certificate(node, agent_verify_ca):
return fname
def node_cache_bios_settings(task, node):
def node_cache_bios_settings(task):
"""Do caching of bios settings if supported by driver"""
try:
LOG.debug('Getting BIOS info for node %s', node.uuid)
LOG.debug('Getting BIOS info for node %s', task.node.uuid)
task.driver.bios.cache_bios_settings(task)
except exception.UnsupportedDriverExtension:
LOG.warning('BIOS settings are not supported for node %s, '
'skipping', node.uuid)
'skipping', task.node.uuid)
except Exception:
# NOTE(dtantsur): the caller expects this function to never fail
msg = (_('Caching of bios settings failed on node %(node)s.')
% {'node': node.uuid})
% {'node': task.node.uuid})
LOG.exception(msg)
@ -1845,3 +1845,19 @@ def node_cache_firmware_components(task):
# NOTE(dtantsur): the caller expects this function to never fail
LOG.exception('Caching of firmware components failed on node %s',
task.node.uuid)
def node_update_cache(task):
"""Updates various cached information.
Includes vendor, boot mode, BIOS settings and firmware components.
:param task: A TaskManager instance containing the node to act on.
"""
# FIXME(dtantsur): in case of Redfish, these 4 calls may result in the
# System object loaded at least 4 times. "Cache whatever you can" should
# probably be a driver call, just not clear in which interface.
node_cache_vendor(task)
node_cache_boot_mode(task)
node_cache_bios_settings(task)
node_cache_firmware_components(task)

View File

@ -73,12 +73,8 @@ def do_node_verify(task):
if error is None:
# NOTE(janders) this can eventually move to driver-specific
# verify steps, will leave this for a follow-up change.
# Retrieve BIOS config settings for this node
utils.node_cache_bios_settings(task, node)
# Cache the vendor if possible
utils.node_cache_vendor(task)
# Cache also boot_mode and secure_boot states
utils.node_cache_boot_mode(task)
utils.node_update_cache(task)
if power_state != node.power_state:
old_power_state = node.power_state
node.power_state = power_state

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Firmware components are now also cached on the transition to the
``manageable`` state in addition to cleaning. This is consisent with how
BIOS settings, vendor and boot mode are cached.