ironic.drivers.base module

Abstract base classes for drivers.

ironic.drivers.base.ALL_INTERFACES = {'bios', 'boot', 'console', 'deploy', 'firmware', 'inspect', 'management', 'network', 'power', 'raid', 'rescue', 'storage', 'vendor'}

Constant holding all known interfaces.

class ironic.drivers.base.BIOSInterface(*args, **kwargs)[source]

Bases: BaseInterface

abstract apply_configuration(task, settings)[source]

Validate & apply BIOS settings on the given node.

This method takes the BIOS settings from the settings param and applies BIOS settings on the given node. It may also validate the given bios settings before applying any settings and manage failures when setting an invalid BIOS config. In the case of needing password to update the BIOS config, it will be taken from the driver_info properties. After the BIOS configuration is done, cache_bios_settings will be called to update the node’s BIOS setting table with the BIOS configuration applied on the node.

Parameters:
  • task – a TaskManager instance.

  • settings – Dictionary containing the BIOS configuration.

Raises:

UnsupportedDriverExtension, if the node’s driver doesn’t support BIOS configuration.

Raises:

InvalidParameterValue, if validation of settings fails.

Raises:

MissingParameterValue, if some required parameters are missing.

Returns:

states.CLEANWAIT if BIOS configuration is in progress asynchronously or None if it is complete.

abstract cache_bios_settings(task)[source]

Store or update BIOS properties on the given node.

This method stores BIOS properties to the bios_settings table during ‘cleaning’ operation and updates bios_settings table when apply_configuration() and factory_reset() are called to set new BIOS configurations. It will also update the timestamp of each bios setting.

Parameters:

task – a TaskManager instance.

Raises:

UnsupportedDriverExtension, if the node’s driver doesn’t support getting BIOS properties from bare metal.

Returns:

None.

abstract factory_reset(task)[source]

Reset BIOS configuration to factory default on the given node.

This method resets BIOS configuration to factory default on the given node. After the BIOS reset action is done, cache_bios_settings will be called to update the node’s BIOS settings table with default bios settings.

Parameters:

task – a TaskManager instance.

Raises:

UnsupportedDriverExtension, if the node’s driver doesn’t support BIOS reset.

Returns:

states.CLEANWAIT if BIOS configuration is in progress asynchronously or None if it is complete.

interface_type = 'bios'

Interface type, used for clean steps and logging.

class ironic.drivers.base.BareDriver[source]

Bases: object

A bare driver object which will have interfaces attached later.

Any composable interfaces should be added as class attributes of this class, as well as appended to core_interfaces or standard_interfaces here.

property all_interfaces
bios = None

Standard attribute for BIOS related features.

A reference to an instance of :class:BIOSInterface.

boot = None

Standard attribute for boot related features.

A reference to an instance of :class:BootInterface.

console = None

Standard attribute for managing console access.

A reference to an instance of :class:ConsoleInterface.

property core_interfaces

Interfaces that are required to be implemented.

deploy = None

Core attribute for managing deployments.

A reference to an instance of :class:DeployInterface.

firmware = None

Standard attribute for inspection related features.

A reference to an instance of :class:FirmwareInterface.

get_properties()[source]

Get the properties of the driver.

Returns:

dictionary of <property name>:<property description> entries.

inspect = None

Standard attribute for inspection related features.

A reference to an instance of :class:InspectInterface.

management = None

Standard attribute for management related features.

A reference to an instance of :class:ManagementInterface.

network = None

Core attribute for network connectivity.

A reference to an instance of :class:NetworkInterface.

property non_vendor_interfaces
property optional_interfaces

Interfaces that can be no-op.

power = None

Core attribute for managing power state.

A reference to an instance of :class:PowerInterface.

raid = None

Standard attribute for RAID related features.

A reference to an instance of :class:RaidInterface.

rescue = None

Standard attribute for accessing rescue features.

A reference to an instance of :class:RescueInterface.

storage = None

Standard attribute for (remote) storage interface.

A reference to an instance of :class:StorageInterface.

vendor = None

Attribute for accessing any vendor-specific extensions.

A reference to an instance of :class:VendorInterface.

class ironic.drivers.base.BaseInterface(*args, **kwargs)[source]

Bases: object

A base interface implementing common functions for Driver Interfaces.

execute_clean_step(task, step)[source]

Execute the clean step on task.node.

A clean step must take a single positional argument: a TaskManager object. It may take one or more keyword variable arguments (for use with manual cleaning only.)

A step can be executed synchronously or asynchronously. A step should return None if the method has completed synchronously or states.CLEANWAIT if the step will continue to execute asynchronously. If the step executes asynchronously, it should issue a call to the ‘continue_node_clean’ RPC, so the conductor can begin the next clean step.

Parameters:
  • task – A TaskManager object

  • step – The clean step dictionary representing the step to execute

Returns:

None if this method has completed synchronously, or states.CLEANWAIT if the step will continue to execute asynchronously.

execute_deploy_step(task, step)[source]

Execute the deploy step on task.node.

A deploy step must take a single positional argument: a TaskManager object. It may take one or more keyword variable arguments (for use in the future, when deploy steps can be specified via the API).

A step can be executed synchronously or asynchronously. A step should return None if the method has completed synchronously or states.DEPLOYWAIT if the step will continue to execute asynchronously. If the step executes asynchronously, it should issue a call to the ‘continue_node_deploy’ RPC, so the conductor can begin the next deploy step.

Parameters:
  • task – A TaskManager object

  • step – The deploy step dictionary representing the step to execute

Returns:

None if this method has completed synchronously, or states.DEPLOYWAIT if the step will continue to execute asynchronously.

execute_service_step(task, step)[source]

Execute the service step on task.node.

A verify step must take a single positional argument: a TaskManager object. It does not take keyword variable arguments.

Parameters:
  • task – A TaskManager object

  • step – The deploy step dictionary representing the step to execute

Returns:

None if this method has completed synchronously

execute_verify_step(task, step)[source]

Execute the verify step on task.node.

A verify step must take a single positional argument: a TaskManager object. It does not take keyword variable arguments.

Parameters:
  • task – A TaskManager object

  • step – The deploy step dictionary representing the step to execute

Returns:

None if this method has completed synchronously

get_clean_steps(task)[source]

Get a list of (enabled and disabled) clean steps for the interface.

This function will return all clean steps (both enabled and disabled) for the interface, in an unordered list.

Parameters:

task – A TaskManager object, useful for interfaces overriding this function

Raises:

NodeCleaningFailure – if there is a problem getting the steps from the driver. For example, when a node (using an agent driver) has just been enrolled and the agent isn’t alive yet to be queried for the available clean steps.

Returns:

A list of clean step dictionaries

get_deploy_steps(task)[source]

Get a list of (enabled and disabled) deploy steps for the interface.

This function will return all deploy steps (both enabled and disabled) for the interface, in an unordered list.

Parameters:

task – A TaskManager object, useful for interfaces overriding this function

Raises:

InstanceDeployFailure – if there is a problem getting the steps from the driver. For example, when a node (using an agent driver) has just been enrolled and the agent isn’t alive yet to be queried for the available deploy steps.

Returns:

A list of deploy step dictionaries

abstract get_properties()[source]

Return the properties of the interface.

Returns:

dictionary of <property name>:<property description> entries.

get_service_steps(task)[source]

Get a list of service steps for the interface.

This function will return all service steps (both enabled and disabled) for the interface, in an unordered list.

Parameters:

task – A TaskManager object, useful for interfaces overriding this function

Raises:

NodeServiceFailure – if there is a problem getting the steps from the driver. For example, when a node (using an agent driver) has just been enrolled and the agent isn’t alive yet to be queried for the available clean steps.

Returns:

A list of clean step dictionaries

get_verify_steps(task)[source]

Get a list of (enabled and disabled) verify steps for the interface.

This function will return all verify steps (both enabled and disabled) for the interface, in an unordered list.

Parameters:

task – A TaskManager object, useful for interfaces overriding this function

Raises:

NodeVerifyFailure – if there is a problem getting the steps from the driver. For example, when a node (using an agent driver) has just been enrolled and the agent isn’t alive yet to be queried for the available verify steps.

Returns:

A list of deploy step dictionaries

interface_type = 'base'

Interface type, used for clean steps and logging.

supported = True

Indicates if an interface is supported.

This will be set to False for interfaces which are untested in first- or third-party CI, or in the process of being deprecated.

abstract validate(task)[source]

Validate the driver-specific Node deployment info.

This method validates whether the ‘driver_info’ and/or ‘instance_info’ properties of the task’s node contains the required information for this interface to function.

This method is often executed synchronously in API requests, so it should not conduct long-running checks.

Parameters:

task – A TaskManager instance containing the node to act on.

Raises:

InvalidParameterValue on malformed parameter(s)

Raises:

MissingParameterValue on missing parameter(s)

class ironic.drivers.base.BootInterface(*args, **kwargs)[source]

Bases: BaseInterface

Interface for boot-related actions.

capabilities = []
abstract clean_up_instance(task)[source]

Cleans up the boot of instance.

This method cleans up the environment that was setup for booting the instance.

Parameters:

task – A task from TaskManager.

Returns:

None

abstract clean_up_ramdisk(task)[source]

Cleans up the boot of ironic ramdisk.

This method cleans up the environment that was setup for booting the deploy or rescue ramdisk.

Parameters:

task – A task from TaskManager.

Returns:

None

interface_type = 'boot'

Interface type, used for clean steps and logging.

abstract prepare_instance(task)[source]

Prepares the boot of instance.

This method prepares the boot of the instance after reading relevant information from the node’s database.

Parameters:

task – A task from TaskManager.

Returns:

None

abstract prepare_ramdisk(task, ramdisk_params)[source]

Prepares the boot of Ironic ramdisk.

This method prepares the boot of the deploy or rescue ramdisk after reading relevant information from the node’s database.

Parameters:
  • task – A task from TaskManager.

  • ramdisk_params

    The options to be passed to the ironic ramdisk. Different implementations might want to boot the ramdisk in different ways by passing parameters to them. For example,

    When Agent ramdisk is booted to deploy a node, it takes the parameters ipa-api-url, etc.

    Other implementations can make use of ramdisk_params to pass such information. Different implementations of boot interface will have different ways of passing parameters to the ramdisk.

Returns:

None

validate_inspection(task)[source]

Validate that the node has required properties for inspection.

Parameters:

task – A TaskManager instance with the node being checked

Raises:

MissingParameterValue if node is missing one or more required parameters

Raises:

UnsupportedDriverExtension

validate_rescue(task)[source]

Validate that the node has required properties for rescue.

Parameters:

task – A TaskManager instance with the node being checked

Raises:

MissingParameterValue if node is missing one or more required parameters

Raises:

UnsupportedDriverExtension

class ironic.drivers.base.ConsoleInterface(*args, **kwargs)[source]

Bases: BaseInterface

Interface for console-related actions.

abstract get_console(task)[source]

Get connection information about the console.

This method should return the necessary information for the client to access the console.

Parameters:

task – A TaskManager instance containing the node to act on.

Returns:

the console connection information.

interface_type = 'console'

Interface type, used for clean steps and logging.

abstract start_console(task)[source]

Start a remote console for the task’s node.

This method should not raise an exception if console already started.

Parameters:

task – A TaskManager instance containing the node to act on.

abstract stop_console(task)[source]

Stop the remote console session for the task’s node.

Parameters:

task – A TaskManager instance containing the node to act on.

class ironic.drivers.base.DeployInterface(*args, **kwargs)[source]

Bases: BaseInterface

Interface for deploy-related actions.

abstract clean_up(task)[source]

Clean up the deployment environment for the task’s node.

If preparation of the deployment environment ahead of time is possible, this method should be implemented by the driver. It should erase anything cached by the prepare method.

If implemented, this method must be idempotent. It may be called multiple times for the same node on the same conductor, and it may be called by multiple conductors in parallel. Therefore, it must not require an exclusive lock.

This method is called before tear_down.

Parameters:

task – A TaskManager instance containing the node to act on.

abstract deploy(task)[source]

Perform a deployment to the task’s node.

Perform the necessary work to deploy an image onto the specified node. This method will be called after prepare(), which may have already performed any preparatory steps, such as pre-caching some data for the node.

Parameters:

task – A TaskManager instance containing the node to act on.

Returns:

status of the deploy. One of ironic.common.states.

heartbeat(task, callback_url, agent_version, agent_verify_ca=None, agent_status=None, agent_status_message=None)[source]

Record a heartbeat for the node.

Parameters:
  • task – A TaskManager instance containing the node to act on.

  • callback_url – a URL to use to call to the ramdisk.

  • agent_version – The version of the agent that is heartbeating

  • agent_verify_ca – TLS certificate for the agent.

  • agent_status – Status of the heartbeating agent

  • agent_status_message – Message describing the agent status

Returns:

None

interface_type = 'deploy'

Interface type, used for clean steps and logging.

abstract prepare(task)[source]

Prepare the deployment environment for the task’s node.

If preparation of the deployment environment ahead of time is possible, this method should be implemented by the driver.

If implemented, this method must be idempotent. It may be called multiple times for the same node on the same conductor.

This method is called before deploy.

Parameters:

task – A TaskManager instance containing the node to act on.

prepare_cleaning(task)[source]

Prepare the node for cleaning tasks.

For example, nodes that use the Ironic Python Agent will need to boot the ramdisk in order to do in-band cleaning tasks.

If the function is asynchronous, the driver will need to handle settings node.driver_internal_info[‘clean_steps’] and node.clean_step, as they would be set in ironic.conductor.manager._do_node_clean, but cannot be set when this is asynchronous. After, the interface should make an RPC call to continue_node_cleaning to start cleaning.

NOTE(JoshNang) this should be moved to BootInterface when it gets implemented.

Parameters:

task – A TaskManager instance containing the node to act on.

Returns:

If this function is going to be asynchronous, should return states.CLEANWAIT. Otherwise, should return None. The interface will need to call _get_cleaning_steps and then RPC to continue_node_cleaning

prepare_service(task)[source]

Prepare the node for servicing tasks.

For example, nodes that use the Ironic Python Agent will need to boot the ramdisk in order to do in-band service tasks.

If the function is asynchronous, the driver will need to handle settings node.driver_internal_info[‘service_steps’] and node.service_step, as they would be set in ironic.conductor.manager._do_node_service, but cannot be set when this is asynchronous. After, the interface should make an RPC call to continue_node_servicing to start cleaning.

Parameters:

task – A TaskManager instance containing the node to act on.

Returns:

If this function is going to be asynchronous, should return states.SERVICEWAIT. Otherwise, should return None. The interface will need to call _get_cleaning_steps and then RPC to continue_node_service.

abstract take_over(task)[source]

Take over management of this task’s node from a dead conductor.

If conductors’ hosts maintain a static relationship to nodes, this method should be implemented by the driver to allow conductors to perform the necessary work during the remapping of nodes to conductors when a conductor joins or leaves the cluster.

For example, the PXE driver has an external dependency:

Neutron must forward DHCP BOOT requests to a conductor which has prepared the tftpboot environment for the given node. When a conductor goes offline, another conductor must change this setting in Neutron as part of remapping that node’s control to itself. This is performed within the takeover method.

Parameters:

task – A TaskManager instance containing the node to act on.

abstract tear_down(task)[source]

Tear down a previous deployment on the task’s node.

Given a node that has been previously deployed to, do all cleanup and tear down necessary to “un-deploy” that node.

Parameters:

task – A TaskManager instance containing the node to act on.

Returns:

status of the deploy. One of ironic.common.states.

tear_down_cleaning(task)[source]

Tear down after cleaning is completed.

Given that cleaning is complete, do all cleanup and tear down necessary to allow the node to be deployed to again.

NOTE(JoshNang) this should be moved to BootInterface when it gets implemented.

Parameters:

task – A TaskManager instance containing the node to act on.

tear_down_service(task)[source]

Tear down after servicing is completed.

Given that servicing is complete, do all cleanup and tear down necessary to allow the node to be returned to an active state.

Parameters:

task – A TaskManager instance containing the node to act on.

class ironic.drivers.base.FirmwareInterface(*args, **kwargs)[source]

Bases: BaseInterface

Base class for firmware interface

abstract cache_firmware_components(task)[source]

Store or update Firmware Components on the given node.

This method stores Firmware Components to the firmware_information table during ‘cleaning’ operation. It will also update the timestamp of each Firmware Component.

Parameters:

task – a TaskManager instance.

Raises:

UnsupportedDriverExtension, if the node’s driver doesn’t support getting Firmware Components from bare metal.

interface_type = 'firmware'

Interface type, used for clean steps and logging.

abstract update(task, settings)[source]

Update the Firmware on the given using the settings for components.

Parameters:
  • task – a TaskManager instance.

  • settings – a list of dictionaries, each dictionary contains the component name and the url that will be used to update the firmware.

Raises:

UnsupportedDriverExtension, if the node’s driver doesn’t support update via the interface.

Raises:

InvalidParameterValue, if validation of the settings fails.

Raises:

MissingParamterValue, if some required parameters are missing.

Returns:

states.CLEANWAIT if Firmware update with the settings is in progress asynchronously of None if it is complete.

class ironic.drivers.base.InspectInterface(*args, **kwargs)[source]

Bases: BaseInterface

Interface for inspection-related actions.

ESSENTIAL_PROPERTIES = {'cpu_arch', 'local_gb', 'memory_mb'}

The properties required by scheduler/deploy.

abort(task)[source]

Abort asynchronized hardware inspection.

Abort an ongoing hardware introspection, this is only used for asynchronize based inspect interface.

NOTE: This interface is called with node exclusive lock held, the interface implementation is expected to be a quick processing.

Parameters:

task – a task from TaskManager.

Raises:

UnsupportedDriverExtension, if the method is not implemented by specific inspect interface.

continue_inspection(task, inventory, plugin_data=None)[source]

Continue in-band hardware inspection.

Should not be implemented for purely out-of-band implementations.

Parameters:
  • task – a task from TaskManager.

  • inventory – hardware inventory from the node.

  • plugin_data – optional plugin-specific data.

Raises:

UnsupportedDriverExtension, if the method is not implemented by specific inspect interface.

abstract inspect_hardware(task)[source]

Inspect hardware.

Inspect hardware to obtain the essential & additional hardware properties.

Parameters:

task – A task from TaskManager.

Raises:

HardwareInspectionFailure, if unable to get essential hardware properties.

Returns:

Resulting state of the inspection i.e. states.MANAGEABLE or None.

interface_type = 'inspect'

Interface type, used for clean steps and logging.

class ironic.drivers.base.ManagementInterface(*args, **kwargs)[source]

Bases: BaseInterface

Interface for management related actions.

attach_virtual_media(task, device_type, image_url)[source]

Attach a virtual media device to the node.

Parameters:
Raises:

UnsupportedDriverExtension

detach_virtual_media(task, device_types=None)[source]

Detach some or all virtual media devices from the node.

Parameters:
  • task – A TaskManager instance containing the node to act on.

  • device_types – A collection of device type, ones from ironic.common.boot_devices.VMEDIA_DEVICES. If not provided, all devices are detached.

Raises:

UnsupportedDriverExtension

detect_vendor(task)[source]

Detects, stores, and returns the hardware vendor.

If the Node object properties field does not already contain a vendor field, then this method is intended to query Detects the BMC hardware vendor and stores the returned value with-in the Node object properties field if detected.

Parameters:

task – A task from TaskManager.

Raises:

InvalidParameterValue if an invalid component, indicator or state is specified.

Raises:

MissingParameterValue if a required parameter is missing

Returns:

String representing the BMC reported Vendor or Manufacturer, otherwise returns None.

abstract get_boot_device(task)[source]

Get the current boot device for a node.

Provides the current boot device of the node. Be aware that not all drivers support this.

Parameters:

task – A task from TaskManager.

Raises:

MissingParameterValue if a required parameter is missing

Returns:

A dictionary containing:

boot_device:

Ahe boot device, one of ironic.common.boot_devices or None if it is unknown.

persistent:

Whether the boot device will persist to all future boots or not, None if it is unknown.

get_boot_mode(task)[source]

Get the current boot mode for a node.

Provides the current boot mode of the node.

NOTE: Not all drivers support this method. Older hardware

may not implement that.

Parameters:

task – A task from TaskManager.

Raises:

MissingParameterValue if a required parameter is missing

Raises:

DriverOperationError or its derivative in case of driver runtime error.

Raises:

UnsupportedDriverExtension if requested operation is not supported by the driver

Returns:

The boot mode, one of ironic.common.boot_mode or None if it is unknown.

get_indicator_state(task, component, indicator)[source]

Get current state of the indicator of the hardware component.

Parameters:
  • task – A task from TaskManager.

  • component – The hardware component, one of ironic.common.components.

  • indicator – Indicator ID (as reported by get_supported_indicators).

Raises:

InvalidParameterValue if an invalid component or indicator is specified.

Raises:

MissingParameterValue if a required parameter is missing

Returns:

Current state of the indicator, one of ironic.common.indicator_states.

get_mac_addresses(task)[source]

Get MAC address information for the node.

Parameters:

task – A TaskManager instance containing the node to act on.

Raises:

UnsupportedDriverExtension

Returns:

A list of MAC addresses for the node

get_secure_boot_state(task)[source]

Get the current secure boot state for the node.

NOTE: Not all drivers support this method. Older hardware

may not implement that.

Parameters:

task – A task from TaskManager.

Raises:

MissingParameterValue if a required parameter is missing

Raises:

DriverOperationError or its derivative in case of driver runtime error.

Raises:

UnsupportedDriverExtension if secure boot is not supported by the driver or the hardware

Returns:

Boolean

abstract get_sensors_data(task)[source]

Get sensors data method.

Parameters:

task – A TaskManager instance.

Raises:

FailedToGetSensorData when getting the sensor data fails.

Raises:

FailedToParseSensorData when parsing sensor data fails.

Returns:

Returns a consistent format dict of sensor data grouped by sensor type, which can be processed by Ceilometer. eg,

{
  'Sensor Type 1': {
    'Sensor ID 1': {
      'Sensor Reading': 'current value',
      'key1': 'value1',
      'key2': 'value2'
    },
    'Sensor ID 2': {
      'Sensor Reading': 'current value',
      'key1': 'value1',
      'key2': 'value2'
    }
  },
  'Sensor Type 2': {
    'Sensor ID 3': {
      'Sensor Reading': 'current value',
      'key1': 'value1',
      'key2': 'value2'
    },
    'Sensor ID 4': {
      'Sensor Reading': 'current value',
      'key1': 'value1',
      'key2': 'value2'
    }
  }
}

abstract get_supported_boot_devices(task)[source]

Get a list of the supported boot devices.

Parameters:

task – A task from TaskManager.

Returns:

A list with the supported boot devices defined in ironic.common.boot_devices.

get_supported_boot_modes(task)[source]

Get a list of the supported boot modes.

NOTE: Not all drivers support this method. Older hardware

may not implement that.

Parameters:

task – A task from TaskManager.

Raises:

UnsupportedDriverExtension if requested operation is not supported by the driver

Raises:

DriverOperationError or its derivative in case of driver runtime error.

Raises:

MissingParameterValue if a required parameter is missing

Returns:

A list with the supported boot modes defined in ironic.common.boot_modes. If boot mode support can’t be determined, empty list is returned.

get_supported_indicators(task, component=None)[source]

Get a map of the supported indicators (e.g. LEDs).

Parameters:
  • task – A task from TaskManager.

  • component – If not None, return indicator information for just this component, otherwise return indicators for all existing components.

Returns:

A dictionary of hardware components (ironic.common.components) as keys with values being dictionaries having indicator IDs as keys and indicator properties as values.

{
    'chassis': {
        'enclosure-0': {
            "readonly": true,
            "states": [
                "off",
                "on"
            ]
        }
    },
    'system':
        'blade-A': {
            "readonly": true,
            "states": [
                "pff",
                "on"
            ]
        }
    },
    'drive':
        'ssd0': {
            "readonly": true,
            "states": [
                "off",
                "on"
            ]
        }
    }
}

get_virtual_media(task)[source]

Get all virtual media devices from the node.

Parameters:

task – A TaskManager instance containing the node to act on.

Raises:

UnsupportedDriverExtension

inject_nmi(task)[source]

Inject NMI, Non Maskable Interrupt.

Inject NMI (Non Maskable Interrupt) for a node immediately.

Parameters:

task – A TaskManager instance containing the node to act on.

Raises:

UnsupportedDriverExtension

interface_type = 'management'

Interface type, used for clean steps and logging.

abstract set_boot_device(task, device, persistent=False)[source]

Set the boot device for a node.

Set the boot device to use on next reboot of the node.

Parameters:
  • task – A task from TaskManager.

  • device – The boot device, one of ironic.common.boot_devices.

  • persistent – Boolean value. True if the boot device will persist to all future boots, False if not. Default: False.

Raises:

InvalidParameterValue if an invalid boot device is specified.

Raises:

MissingParameterValue if a required parameter is missing

set_boot_mode(task, mode)[source]

Set the boot mode for a node.

Set the boot mode to use on next reboot of the node.

Drivers implementing this method are required to implement the get_supported_boot_modes method as well.

NOTE: Not all drivers support this method. Hardware supporting only

one boot mode may not implement that.

Parameters:
Raises:

InvalidParameterValue if an invalid boot mode is specified.

Raises:

MissingParameterValue if a required parameter is missing

Raises:

UnsupportedDriverExtension if requested operation is not supported by the driver

Raises:

DriverOperationError or its derivative in case of driver runtime error.

set_indicator_state(task, component, indicator, state)[source]

Set indicator on the hardware component to the desired state.

Parameters:
  • task – A task from TaskManager.

  • component – The hardware component, one of ironic.common.components.

  • indicator – Indicator ID (as reported by get_supported_indicators).

State:

Desired state of the indicator, one of ironic.common.indicator_states.

Raises:

InvalidParameterValue if an invalid component, indicator or state is specified.

Raises:

MissingParameterValue if a required parameter is missing

set_secure_boot_state(task, state)[source]

Set the current secure boot state for the node.

NOTE: Not all drivers support this method. Older hardware

may not implement that.

Parameters:
  • task – A task from TaskManager.

  • state – A new state as a boolean.

Raises:

MissingParameterValue if a required parameter is missing

Raises:

DriverOperationError or its derivative in case of driver runtime error.

Raises:

UnsupportedDriverExtension if secure boot is not supported by the driver or the hardware

class ironic.drivers.base.NetworkInterface(*args, **kwargs)[source]

Bases: BaseInterface

Base class for network interfaces.

abstract add_cleaning_network(task)[source]

Add the cleaning network to a node.

Parameters:

task – A TaskManager instance.

Returns:

a dictionary in the form {port.uuid: neutron_port[‘id’]}

Raises:

NetworkError

add_inspection_network(task)[source]

Add the inspection network to the node.

Parameters:

task – A TaskManager instance.

Returns:

a dictionary in the form {port.uuid: neutron_port[‘id’]}

Raises:

NetworkError

Raises:

InvalidParameterValue, if the network interface configuration is invalid.

abstract add_provisioning_network(task)[source]

Add the provisioning network to a node.

Parameters:

task – A TaskManager instance.

Raises:

NetworkError

add_rescuing_network(task)[source]

Add the rescuing network to the node.

Parameters:

task – A TaskManager instance.

Returns:

a dictionary in the form {port.uuid: neutron_port[‘id’]}

Raises:

NetworkError

Raises:

InvalidParameterValue, if the network interface configuration is invalid.

add_servicing_network(task)[source]

Add the servicing network to the node.

Parameters:

task – A TaskManager instance.

Returns:

a dictionary in the form {port.uuid: neutron_port[‘id’]}

Raises:

NetworkError

Raises:

InvalidParameterValue, if the network interface configuration is invalid.

abstract configure_tenant_networks(task)[source]

Configure tenant networks for a node.

Parameters:

task – A TaskManager instance.

Raises:

NetworkError

abstract get_current_vif(task, p_obj)[source]

Returns the currently used VIF associated with port or portgroup

We are booting the node only in one network at a time, and presence of cleaning_vif_port_id means we’re doing cleaning, of provisioning_vif_port_id - provisioning, of rescuing_vif_port_id - rescuing. Otherwise it’s a tenant network.

Parameters:
  • task – A TaskManager instance.

  • p_obj – Ironic port or portgroup object.

Returns:

VIF ID associated with p_obj or None.

get_node_network_data(task)[source]

Return network configuration for node NICs.

Gather L2 and L3 network settings from ironic port/portgroups objects and underlying network provider, then put together collected data in form of Nova network metadata (network_data.json) dict.

Ironic would eventually pass network configuration to the node being managed out-of-band.

Parameters:

task – A TaskManager instance.

Raises:

InvalidParameterValue, if the network interface configuration is invalid.

Raises:

MissingParameterValue, if some parameters are missing.

Returns:

a dict holding network configuration information adhering Nova network metadata layout (network_data.json).

get_properties()[source]

Return the properties of the interface.

Returns:

dictionary of <property name>:<property description> entries.

interface_type = 'network'

Interface type, used for clean steps and logging.

need_power_on(task)[source]

Check if node must be powered on before applying network changes

Parameters:

task – A TaskManager instance.

Returns:

Boolean.

abstract port_changed(task, port_obj)[source]

Handle any actions required when a port changes

Parameters:
  • task – A TaskManager instance.

  • port_obj – a changed Port object.

Raises:

Conflict, FailedToUpdateDHCPOptOnPort

abstract portgroup_changed(task, portgroup_obj)[source]

Handle any actions required when a port changes

Parameters:
  • task – A TaskManager instance.

  • portgroup_obj – a changed Port object.

Raises:

Conflict, FailedToUpdateDHCPOptOnPort

abstract remove_cleaning_network(task)[source]

Remove the cleaning network from a node.

Parameters:

task – A TaskManager instance.

Raises:

NetworkError

remove_inspection_network(task)[source]

Removes the inspection network from a node.

Parameters:

task – A TaskManager instance.

Raises:

NetworkError

Raises:

InvalidParameterValue, if the network interface configuration is invalid.

Raises:

MissingParameterValue, if some parameters are missing.

abstract remove_provisioning_network(task)[source]

Remove the provisioning network from a node.

Parameters:

task – A TaskManager instance.

remove_rescuing_network(task)[source]

Removes the rescuing network from a node.

Parameters:

task – A TaskManager instance.

Raises:

NetworkError

Raises:

InvalidParameterValue, if the network interface configuration is invalid.

Raises:

MissingParameterValue, if some parameters are missing.

remove_servicing_network(task)[source]

Removes the servicing network from a node.

Parameters:

task – A TaskManager instance.

Raises:

NetworkError

Raises:

InvalidParameterValue, if the network interface configuration is invalid.

Raises:

MissingParameterValue, if some parameters are missing.

abstract unconfigure_tenant_networks(task)[source]

Unconfigure tenant networks for a node.

Parameters:

task – A TaskManager instance.

validate(task)[source]

Validates the network interface.

Parameters:

task – A TaskManager instance.

Raises:

InvalidParameterValue, if the network interface configuration is invalid.

Raises:

MissingParameterValue, if some parameters are missing.

validate_inspection(task)[source]

Validate that the node has required properties for inspection.

Parameters:

task – A TaskManager instance with the node being checked

Raises:

MissingParameterValue if node is missing one or more required parameters

Raises:

UnsupportedDriverExtension

validate_rescue(task)[source]

Validates the network interface for rescue operation.

Parameters:

task – A TaskManager instance.

Raises:

InvalidParameterValue, if the network interface configuration is invalid.

Raises:

MissingParameterValue, if some parameters are missing.

abstract vif_attach(task, vif_info)[source]

Attach a virtual network interface to a node

Parameters:
  • task – A TaskManager instance.

  • vif_info – a dictionary of information about a VIF. It must have an ‘id’ key, whose value is a unique identifier for that VIF.

Raises:

NetworkError, VifAlreadyAttached, NoFreePhysicalPorts

abstract vif_detach(task, vif_id)[source]

Detach a virtual network interface from a node

Parameters:
  • task – A TaskManager instance.

  • vif_id – A VIF ID to detach

Raises:

NetworkError, VifNotAttached

abstract vif_list(task)[source]

List attached VIF IDs for a node

Parameters:

task – A TaskManager instance.

Returns:

List of VIF dictionaries, each dictionary will have an ‘id’ entry with the ID of the VIF.

class ironic.drivers.base.PowerInterface(*args, **kwargs)[source]

Bases: BaseInterface

Interface for power-related actions.

abstract get_power_state(task)[source]

Return the power state of the task’s node.

Parameters:

task – A TaskManager instance containing the node to act on.

Raises:

MissingParameterValue if a required parameter is missing.

Returns:

A power state. One of ironic.common.states.

get_supported_power_states(task)[source]

Get a list of the supported power states.

Parameters:

task – A TaskManager instance containing the node to act on.

Returns:

A list with the supported power states defined in ironic.common.states.

interface_type = 'power'

Interface type, used for clean steps and logging.

abstract reboot(task, timeout=None)[source]

Perform a hard reboot of the task’s node.

Drivers are expected to properly handle case when node is powered off by powering it on.

Parameters:
  • task – A TaskManager instance containing the node to act on.

  • timeout – timeout (in seconds) positive integer (> 0) for any power state. None indicates to use default timeout.

Raises:

MissingParameterValue if a required parameter is missing.

abstract set_power_state(task, power_state, timeout=None)[source]

Set the power state of the task’s node.

Parameters:
  • task – A TaskManager instance containing the node to act on.

  • power_state – Any power state from ironic.common.states.

  • timeout – timeout (in seconds) positive integer (> 0) for any power state. None indicates to use default timeout.

Raises:

MissingParameterValue if a required parameter is missing.

supports_power_sync(task)[source]

Check if power sync is supported for the given node.

If False, the conductor will simply store whatever get_power_state returns in the database instead of trying to force the expected power state.

Parameters:

task – A TaskManager instance containing the node to act on.

Returns:

boolean, whether power sync is supported.

class ironic.drivers.base.RAIDInterface(*args, **kwargs)[source]

Bases: BaseInterface

apply_configuration(task, raid_config, create_root_volume=True, create_nonroot_volumes=True, delete_existing=True)[source]

Applies RAID configuration on the given node.

Parameters:
  • task – A TaskManager instance.

  • raid_config – The RAID configuration to apply.

  • create_root_volume – Setting this to False indicates not to create root volume that is specified in raid_config. Default value is True.

  • create_nonroot_volumes – Setting this to False indicates not to create non-root volumes (all except the root volume) in raid_config. Default value is True.

  • delete_existing – Setting this to True indicates to delete RAID configuration prior to creating the new configuration.

Raises:

InvalidParameterValue, if the RAID configuration is invalid.

Returns:

states.DEPLOYWAIT if RAID configuration is in progress asynchronously or None if it is complete.

abstract create_configuration(task, create_root_volume=True, create_nonroot_volumes=True, delete_existing=True)[source]

Creates RAID configuration on the given node.

This method creates a RAID configuration on the given node. It assumes that the target RAID configuration is already available in node.target_raid_config. Implementations of this interface are supposed to read the RAID configuration from node.target_raid_config. After the RAID configuration is done (either in this method OR in a call-back method), ironic.common.raid.update_raid_info() may be called to sync the node’s RAID-related information with the RAID configuration applied on the node.

Parameters:
  • task – A TaskManager instance.

  • create_root_volume – Setting this to False indicates not to create root volume that is specified in the node’s target_raid_config. Default value is True.

  • create_nonroot_volumes – Setting this to False indicates not to create non-root volumes (all except the root volume) in the node’s target_raid_config. Default value is True.

  • delete_existing – Setting this to True indicates to delete RAID configuration prior to creating the new configuration.

Returns:

states.CLEANWAIT (cleaning) or states.DEPLOYWAIT (deployment) if RAID configuration is in progress asynchronously, or None if it is complete.

abstract delete_configuration(task)[source]

Deletes RAID configuration on the given node.

This method deletes the RAID configuration on the give node. After RAID configuration is deleted, node.raid_config should be cleared by the implementation.

Parameters:

task – A TaskManager instance.

Returns:

states.CLEANWAIT (cleaning) or states.DEPLOYWAIT (deployment) if deletion is in progress asynchronously, or None if it is complete.

get_logical_disk_properties()[source]

Get the properties that can be specified for logical disks.

This method returns a dictionary containing the properties that can be specified for logical disks and a textual description for them.

Returns:

A dictionary containing properties that can be mentioned for logical disks and a textual description for them.

get_properties()[source]

Return the properties of the interface.

Returns:

dictionary of <property name>:<property description> entries.

interface_type = 'raid'

Interface type, used for clean steps and logging.

validate(task)[source]

Validates the RAID Interface.

This method validates the properties defined by Ironic for RAID configuration. Driver implementations of this interface can override this method for doing more validations (such as BMC’s credentials).

Parameters:

task – A TaskManager instance.

Raises:

InvalidParameterValue, if the RAID configuration is invalid.

Raises:

MissingParameterValue, if some parameters are missing.

validate_raid_config(task, raid_config)[source]

Validates the given RAID configuration.

This method validates the given RAID configuration. Driver implementations of this interface can override this method to support custom parameters for RAID configuration.

Parameters:
  • task – A TaskManager instance.

  • raid_config – The RAID configuration to validate.

Raises:

InvalidParameterValue, if the RAID configuration is invalid.

ironic.drivers.base.RAID_APPLY_CONFIGURATION_ARGSINFO = {'create_nonroot_volumes': {'description': "Setting this to 'False' indicates not to create non-root volumes (all except the root volume) in 'raid_config'. Default value is 'True'.", 'required': False}, 'create_root_volume': {'description': "Setting this to 'False' indicates not to create root volume that is specified in 'raid_config'. Default value is 'True'.", 'required': False}, 'delete_existing': {'description': "Setting this to 'True' indicates to delete existing RAID configuration prior to creating the new configuration. Default value is 'True'.", 'required': False}, 'raid_config': {'description': 'The RAID configuration to apply.', 'required': True}}

This may be used as the deploy_step argsinfo argument for RAID interfaces implementing an apply_configuration deploy step.

class ironic.drivers.base.RescueInterface(*args, **kwargs)[source]

Bases: BaseInterface

Interface for rescue-related actions.

clean_up(task)[source]

Clean up the rescue environment for the task’s node.

This is particularly useful for nodes where rescuing is asynchronous and a timeout occurs.

Parameters:

task – A TaskManager instance containing the node to act on.

Returns:

None

interface_type = 'rescue'

Interface type, used for clean steps and logging.

abstract rescue(task)[source]

Boot the task’s node into a rescue environment.

Parameters:

task – A TaskManager instance containing the node to act on.

Raises:

InstanceRescueFailure if node validation or rescue operation fails.

Returns:

states.RESCUEWAIT if rescue is in progress asynchronously or states.RESCUE if it is complete.

abstract unrescue(task)[source]

Tear down the rescue environment, and return to normal.

Parameters:

task – A TaskManager instance containing the node to act on.

Raises:

InstanceUnrescueFailure if node validation or unrescue operation fails.

Returns:

states.ACTIVE if it is successful.

class ironic.drivers.base.StorageInterface(*args, **kwargs)[source]

Bases: BaseInterface

Base class for storage interfaces.

abstract attach_volumes(task)[source]

Informs the storage subsystem to attach all volumes for the node.

Parameters:

task – A TaskManager instance.

Raises:

UnsupportedDriverExtension

abstract detach_volumes(task)[source]

Informs the storage subsystem to detach all volumes for the node.

Parameters:

task – A TaskManager instance.

Raises:

UnsupportedDriverExtension

interface_type = 'storage'

Interface type, used for clean steps and logging.

abstract should_write_image(task)[source]

Determines if deploy should perform the image write-out.

Parameters:

task – A TaskManager instance.

Returns:

Boolean value to indicate if the interface expects the image to be written by Ironic.

Raises:

UnsupportedDriverExtension

class ironic.drivers.base.VendorInterface(*args, **kwargs)[source]

Bases: BaseInterface

Interface for all vendor passthru functionality.

Additional vendor- or driver-specific capabilities should be implemented as a method in the class inheriting from this class and use the @passthru or @driver_passthru decorators.

Methods decorated with @driver_passthru should be short-lived because it is a blocking call.

driver_validate(method, **kwargs)[source]

Validate driver-vendor-passthru actions.

If invalid, raises an exception; otherwise returns None.

Parameters:
  • method – method to be validated

  • kwargs – info for action.

Raises:

MissingParameterValue if kwargs does not contain certain parameter.

Raises:

InvalidParameterValue if parameter does not match.

interface_type = 'vendor'

Interface type, used for clean steps and logging.

abstract validate(task, method=None, **kwargs)[source]

Validate vendor-specific actions.

If invalid, raises an exception; otherwise returns None.

Parameters:
  • task – A task from TaskManager.

  • method – Method to be validated

  • kwargs – Info for action.

Raises:

UnsupportedDriverExtension if ‘method’ can not be mapped to the supported interfaces.

Raises:

InvalidParameterValue if kwargs does not contain ‘method’.

Raises:

MissingParameterValue

class ironic.drivers.base.VendorMetadata(method, metadata)

Bases: tuple

metadata

Alias for field number 1

method

Alias for field number 0

ironic.drivers.base.cache_bios_settings(func)[source]

A decorator to cache bios settings after running the function.

Parameters:

func – Function or method to wrap.

ironic.drivers.base.cache_firmware_components(func)[source]

A decorator to cache firmware components after running the function.

Parameters:

func – Function or method to wrap.

ironic.drivers.base.clean_step(priority, abortable=False, argsinfo=None, requires_ramdisk=True)[source]

Decorator for cleaning steps.

Cleaning steps may be used in manual or automated cleaning.

For automated cleaning, only steps with priorities greater than 0 are used. These steps are ordered by priority from highest value to lowest value. For steps with the same priority, they are ordered by driver interface priority (see conductor.steps.CLEANING_INTERFACE_PRIORITY). execute_clean_step() will be called on each step.

For manual cleaning, the clean steps will be executed in a similar fashion to automated cleaning, but the steps and order of execution must be explicitly specified by the user when invoking the cleaning API.

Decorated clean steps must take as the only positional argument, a TaskManager object. Clean steps used in manual cleaning may also take keyword variable arguments (as described in argsinfo).

Clean steps can be either synchronous or asynchronous. If the step is synchronous, it should return None when finished, and the conductor will continue on to the next step. While the clean step is executing, the node will be in states.CLEANING provision state. If the step is asynchronous, the step should return states.CLEANWAIT to the conductor before it starts the asynchronous work. When the step is complete, the step should make an RPC call to continue_node_clean to move to the next step in cleaning. The node will be in states.CLEANWAIT provision state during the asynchronous work.

Examples:

class MyInterface(base.BaseInterface):
    # CONF.example_cleaning_priority should be an int CONF option
    @base.clean_step(priority=CONF.example_cleaning_priority)
    def example_cleaning(self, task):
        # do some cleaning

    @base.clean_step(priority=0, abortable=True, argsinfo=
                     {'size': {'description': 'size of widget (MB)',
                               'required': True}})
    def advanced_clean(self, task, **kwargs):
        # do some advanced cleaning
Parameters:
  • priority – an integer priority, should be a CONF option

  • abortable – Boolean value. Whether the clean step is abortable or not; defaults to False.

  • argsinfo

    a dictionary of keyword arguments where key is the name of the argument and value is a dictionary as follows:

    'description': <description>. Required. This should include
                   possible values.
    'required': Boolean. Optional; default is False. True if this
                argument is required.  If so, it must be specified in
                the clean request; false if it is optional.
    

  • requires_ramdisk – Whether this step requires the ramdisk to be running. Should be set to False for purely out-of-band steps.

Raises:

InvalidParameterValue – if any of the arguments are invalid

ironic.drivers.base.deploy_step(priority, argsinfo=None)[source]

Decorator for deployment steps.

Only steps with priorities greater than 0 are used. These steps are ordered by priority from highest value to lowest value. For steps with the same priority, they are ordered by driver interface priority (see conductor.steps.DEPLOYING_INTERFACE_PRIORITY). execute_deploy_step() will be called on each step.

Decorated deploy steps must take as the only positional argument, a TaskManager object.

Deploy steps can be either synchronous or asynchronous. If the step is synchronous, it should return None when finished, and the conductor will continue on to the next step. While the deploy step is executing, the node will be in states.DEPLOYING provision state. If the step is asynchronous, the step should return states.DEPLOYWAIT to the conductor before it starts the asynchronous work. When the step is complete, the step should make an RPC call to continue_node_deploy to move to the next step in deployment. The node will be in states.DEPLOYWAIT provision state during the asynchronous work.

Examples:

class MyInterface(base.BaseInterface):
    @base.deploy_step(priority=100)
    def example_deploying(self, task):
        # do some deploying
Parameters:
  • priority – an integer (>=0) priority; used for determining the order in which the step is run in the deployment process.

  • argsinfo

    a dictionary of keyword arguments where key is the name of the argument and value is a dictionary as follows:

    'description': <description>. Required. This should include
                   possible values.
    'required': Boolean. Optional; default is False. True if this
                argument is required.  If so, it must be specified in
                the deployment request; false if it is optional.
    

Raises:

InvalidParameterValue – if any of the arguments are invalid

ironic.drivers.base.driver_passthru(http_methods, method=None, async_call=True, description=None, attach=False)[source]
ironic.drivers.base.passthru(http_methods, method=None, async_call=True, description=None, attach=False, require_exclusive_lock=True)[source]
ironic.drivers.base.service_step(priority=None, abortable=False, argsinfo=None, requires_ramdisk=True)[source]

Decorator for service steps.

Service steps may be used in performing service upon a node.

For service, the steps will be executed in a similar fashion to cleaning, but the steps and order of execution must be explicitly specified by the user when invoking the servicing API.

Decorated service steps must take as the only a single positional argument, a TaskManager object, in addition to a keyword arguments variable (as described in argsinfo).

Service steps can be either synchronous or asynchronous. If the step is synchronous, it should return None when finished, and the conductor will continue on to the next step. While the clean step is executing, the node will be in states.SERVICING provision state. If the step is asynchronous, the step should return states.SERVICEWAIT to the conductor before it starts the asynchronous work. When the step is complete, the step should make an RPC call to continue_node_service to move to the next step in servicing. The node will be in states.SERVICEWAIT provision state during the asynchronous work.

Examples:

class MyInterface(base.BaseInterface):
    @base.service_step()
    def example_service(self, task):
        # do some service actions

    @base.service_step(priority=0, abortable=True, argsinfo=
                       {'size': {'description': 'size of widget (MB)',
                                 'required': True}})
    def advanced_service(self, task, **kwargs):
        # do some advanced magical service
Parameters:
  • priority – an integer priority, defaults to None which maps to 0. Priorities are not considered, by default but exists should this functionality be adopted later on to align with the steps framework.

  • abortable – Boolean value. Whether the clean step is abortable or not; defaults to False.

  • argsinfo

    a dictionary of keyword arguments where key is the name of the argument and value is a dictionary as follows:

    'description': <description>. Required. This should include
                   possible values.
    'required': Boolean. Optional; default is False. True if this
                argument is required.  If so, it must be specified in
                the service request; false if it is optional.
    

  • requires_ramdisk – Whether this step requires the ramdisk to be running. Should be set to False for purely out-of-band steps.

Raises:

InvalidParameterValue – if any of the arguments are invalid

ironic.drivers.base.verify_step(priority)[source]

Decorator for verify steps.

Only steps with priorities greater than 0 are used. These steps are ordered by priority from highest value to lowest value. For steps with the same priority, they are ordered by driver interface priority (see conductor.steps.VERIFY_INTERFACE_PRIORITY). execute_verify_step() will be called on each step.

Decorated verify steps must take as the only positional argument, a TaskManager object.

Verify steps are synchronous and should return None when finished, and the conductor will continue on to the next step. While the verify step is executing, the node will be in states.VERIFYING provision state.

Examples:

class MyInterface(base.BaseInterface):
    @base.verify_step(priority=100)
    def example_verifying(self, task):
        # do some verifying
Parameters:

priority – an integer (>=0) priority; used for determining the order in which the step is run in the verification process.

Raises:

InvalidParameterValue – if any of the arguments are invalid