diff --git a/ironic/conductor/cleaning.py b/ironic/conductor/cleaning.py index cd2d999397..dde81d63c3 100644 --- a/ironic/conductor/cleaning.py +++ b/ironic/conductor/cleaning.py @@ -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: diff --git a/ironic/conductor/utils.py b/ironic/conductor/utils.py index 74c146f94f..9dbfcfeee7 100644 --- a/ironic/conductor/utils.py +++ b/ironic/conductor/utils.py @@ -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) diff --git a/ironic/conductor/verify.py b/ironic/conductor/verify.py index 812472b837..d67757d9d0 100644 --- a/ironic/conductor/verify.py +++ b/ironic/conductor/verify.py @@ -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 diff --git a/releasenotes/notes/cache-firmware-components-485b3343ba1db5ee.yaml b/releasenotes/notes/cache-firmware-components-485b3343ba1db5ee.yaml new file mode 100644 index 0000000000..4ba3a6b9f0 --- /dev/null +++ b/releasenotes/notes/cache-firmware-components-485b3343ba1db5ee.yaml @@ -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.