ironic.drivers.modules.redfish.utils module¶
- ironic.drivers.modules.redfish.utils.BIOS = 'bios'¶
BIOS Firmware Component
- ironic.drivers.modules.redfish.utils.BMC = 'bmc'¶
BMC Firmware Component
- class ironic.drivers.modules.redfish.utils.BootProgressStatus(*values)[source]¶
Bases:
EnumOutcome of checking a node’s BootProgress against target states.
- PASSED = 'passed'¶
The node has booted far enough for the current step.
- UNAVAILABLE = 'unavailable'¶
The node does not report BootProgress.
- WAITING = 'waiting'¶
The node has not been seen to boot far enough yet.
- ironic.drivers.modules.redfish.utils.FIRMWARE_COMPONENTS = ['bios', 'bmc']¶
Firmware Components available to update
- ironic.drivers.modules.redfish.utils.NIC = 'nic'¶
NIC Firmware Component type
- ironic.drivers.modules.redfish.utils.NIC_COMPONENT_PREFIX = 'nic:'¶
Prefix for NIC Firmware Components
- class ironic.drivers.modules.redfish.utils.SessionCache(driver_info)[source]¶
Bases:
objectCache of HTTP sessions credentials
- AUTH_CLASSES = {'auto': <class 'sushy.auth.SessionOrBasicAuth'>, 'basic': <class 'sushy.auth.BasicAuth'>, 'session': <class 'sushy.auth.SessionAuth'>}¶
- ironic.drivers.modules.redfish.utils.boot_changed_since(before, current)[source]¶
Check whether the host has reset since an earlier observation.
A reboot request does not reset BootProgress: until the host actually resets, the BMC keeps reporting the state the previous boot reached. The host has reset if
LastResetTimediffers from the reading taken before the reboot, or ifLastStatehas changed to a state reported only before POST completes. A late update movingLastStateforward within the previous boot proves nothing, nor does a marker missing from either observation.- Parameters:
before – an observation from
get_boot_observation()taken before the reboot was requested, or None if it could not be read.current – an observation taken since.
- Returns:
True if the host has reset since
before, False if nothing shows that it has.
- ironic.drivers.modules.redfish.utils.check_boot_progress(node, system, target_states, reboot_time=None, check_delay=0, new_boot_observed=False)[source]¶
Check a node’s Redfish BootProgress against the target states.
A target state read shortly after a reboot request may still describe the previous boot, so it is only accepted once the caller has seen the host reset (
new_boot_observed, seeboot_changed_since()) orcheck_delayseconds have passed sincereboot_time.- Parameters:
node – an ironic node object, used for logging only.
system – an already-fetched sushy System object. Callers are responsible for fetching it; this function performs no I/O.
target_states – an iterable of
sushy.BootProgressStatesmembers that satisfy the gate.reboot_time – ISO-formatted timestamp string of when the reboot was requested, or None to accept a target state without further checks.
check_delay – number of seconds that must have elapsed since
reboot_timebefore a target state is accepted without proof that the host reset.new_boot_observed – whether the caller has seen the host reset since the reboot.
- Returns:
a tuple of (status, last_state) where status is a BootProgressStatus, and last_state is the
sushy.BootProgressStatesvalue observed, or None.- Raises:
sushy.exceptions.SushyError when the BootProgress resource cannot be read; callers should retry on the next poll.
- ironic.drivers.modules.redfish.utils.get_boot_observation(system)[source]¶
Read the markers of a system that change when its host resets.
- Parameters:
system – an already-fetched sushy System object. Callers are responsible for fetching it; this function performs no I/O.
- Returns:
a dict that can be stored in
driver_internal_info, with the keysstate(BootProgressLastState) andreset_time(LastResetTime), each a string, or None where the BMC does not report it.
- ironic.drivers.modules.redfish.utils.get_boot_progress_targets(node)[source]¶
Get the BootProgress target states for the node’s current step.
- Parameters:
node – an ironic node object.
- Returns:
a frozenset of
sushy.BootProgressStatesmembers that satisfy the BootProgress gate for the step currently running on the node.- Raises:
IronicException if no clean, deploy or service step is running on the node.
- ironic.drivers.modules.redfish.utils.get_chassis(node, system)[source]¶
Get a Redfish Chassis associated with a System of a node
- Parameters:
node – an Ironic node object
system – the Sushy System object
- Raises:
RedfishConnectionError when it fails to connect to Redfish
- Raises:
RedfishError if there is no Chassis registered
- ironic.drivers.modules.redfish.utils.get_component_type(component)[source]¶
Determine the type of firmware component.
Note: This helper exists primarily to handle NIC components which use a prefix pattern (e.g., ‘nic:BCM57414’, ‘nic:adapter1’) rather than exact string matches. This centralizes the component type detection logic that is used in multiple places (update initiation, task monitoring, completion handling) and provides a single source of truth for component type classification.
- Parameters:
component – The component name from settings
- Returns:
One of ‘bios’, ‘bmc’, ‘nic’, or None
- ironic.drivers.modules.redfish.utils.get_enabled_macs(task, system)[source]¶
Get information on MAC addresses of enabled ports using Redfish.
- Parameters:
task – a TaskManager instance containing the node to act on.
system – a Redfish System object
- Returns:
a dictionary containing MAC addresses of enabled interfaces in a {‘mac’: <state>} format, where <state> is a sushy constant
- ironic.drivers.modules.redfish.utils.get_event_service(node)[source]¶
Get a node’s event service.
- Parameters:
node – an Ironic node object.
- Raises:
RedfishConnectionError when it fails to connect to Redfish
- Raises:
RedfishError when the EventService is not registered in Redfish
- ironic.drivers.modules.redfish.utils.get_first_controller(storage)[source]¶
Get the first storage controller from a storage object.
- Parameters:
storage – a storage object
- Returns:
the first storage controller or None
- ironic.drivers.modules.redfish.utils.get_manager(node, system, manager_id=None)[source]¶
Get a node’s manager.
- Parameters:
system – a Sushy system object
manager_id – the id of the manager
- Returns:
a sushy Manager
- Raises:
RedfishError when the System doesn’t have Managers associated
- ironic.drivers.modules.redfish.utils.get_root_vendor(node)[source]¶
Get the BMC vendor from the Redfish Service Root.
- Parameters:
node – an Ironic node object
- Returns:
The Vendor string from the ServiceRoot, or None
- ironic.drivers.modules.redfish.utils.get_system(node)[source]¶
Get a Redfish System that represents a node.
- Parameters:
node – an Ironic node object
- Raises:
RedfishConnectionError when it fails to connect to Redfish
- Raises:
RedfishError if the System is not registered in Redfish
- ironic.drivers.modules.redfish.utils.get_system_collection(node)[source]¶
Get a Redfish System Collection that includes the node
- Parameters:
node – an Ironic node object
- Raises:
RedfishConnectionError when it fails to connect to Redfish
- Raises:
RedfishError if the System is not registered in Redfish
- ironic.drivers.modules.redfish.utils.get_task_monitor(node, uri)[source]¶
Get a TaskMonitor for a node.
- Parameters:
node – an Ironic node object
uri – the URI of a TaskMonitor
- Raises:
RedfishConnectionError when it fails to connect to Redfish
- Raises:
RedfishError when the TaskMonitor is not available in Redfish
- ironic.drivers.modules.redfish.utils.get_update_service(node)[source]¶
Get a node’s update service.
- Parameters:
node – an Ironic node object
- Raises:
RedfishConnectionError when it fails to connect to Redfish
- Raises:
RedfishError when the UpdateService is not registered in Redfish
- ironic.drivers.modules.redfish.utils.parse_driver_info(node)[source]¶
Parse the information required for Ironic to connect to Redfish.
- Parameters:
node – an Ironic node object
- Returns:
dictionary of parameters
- Raises:
InvalidParameterValue on malformed parameter(s)
- Raises:
MissingParameterValue on missing parameter(s)