ironic.drivers.modules.boot_mode_utils module

ironic.drivers.modules.boot_mode_utils.configure_secure_boot_if_needed(task)[source]

Configures secure boot if it has been requested for the node.

ironic.drivers.modules.boot_mode_utils.deconfigure_secure_boot_if_needed(task)[source]

Deconfigures secure boot if it has been requested for the node.

ironic.drivers.modules.boot_mode_utils.get_boot_mode(node)[source]

Returns the boot mode.

Parameters:

node – an ironic node object.

Returns:

‘bios’ or ‘uefi’

Raises:

InvalidParameterValue, if the node boot mode disagrees with the boot mode set to node properties/capabilities

ironic.drivers.modules.boot_mode_utils.get_boot_mode_for_deploy(node)[source]

Returns the boot mode that would be used for deploy.

This method returns boot mode to be used for deploy. It returns ‘uefi’ if ‘secure_boot’ is set to ‘true’ in ‘instance_info/capabilities’ of node. Otherwise it returns value of ‘boot_mode’ in ‘properties/capabilities’ of node if set. If that is not set, it returns boot mode in ‘internal_driver_info/deploy_boot_mode’ for the node. If that is not set, it returns boot mode in ‘instance_info/deploy_boot_mode’ for the node. It would return None if boot mode is present neither in ‘capabilities’ of node ‘properties’ nor in node’s ‘internal_driver_info’ nor in node’s ‘instance_info’ (which could also be None).

Parameters:

node – an ironic node object.

Returns:

‘bios’, ‘uefi’ or None

Raises:

InvalidParameterValue, if the node boot mode disagrees with the boot mode set to node properties/capabilities

ironic.drivers.modules.boot_mode_utils.is_secure_boot_requested(node)[source]

Returns True if secure_boot is requested for deploy.

This method checks node property for secure_boot and returns True if it is requested.

Parameters:

node – a single Node.

Raises:

InvalidParameterValue if the capabilities string is not a dictionary or is malformed.

Returns:

True if secure_boot is requested.

ironic.drivers.modules.boot_mode_utils.sync_boot_mode(task)[source]

Set node’s boot mode from bare metal configuration

Attempt to read currently set boot mode off the bare metal machine. Also read node’s boot mode configuration:

  • If BM driver does not implement getting boot mode, assume BM boot mode is not set and apply the logic that follows

  • If Ironic node boot mode is not set and BM node boot mode is not set - set Ironic boot mode to [deploy]/default_boot_mode

  • If Ironic node boot mode is not set and BM node boot mode is set - set BM node boot mode on the Ironic node

  • If Ironic node boot mode is set and BM node boot mode is not set - set Ironic boot mode to BM boot mode

  • If both Ironic and BM node boot modes are set but they differ - try to set Ironic boot mode to BM boot mode and fail hard if underlying hardware type does not support setting boot mode

In the end, the new boot mode may be set in ‘driver_internal_info/deploy_boot_mode’.

Parameters:

task – a task object