ironic.drivers.modules.ipmitool module

IPMI power manager driver.

Uses the ‘ipmitool’ command (http://ipmitool.sourceforge.net/) to remotely manage hardware. This includes setting the boot device, getting a serial-over-LAN console, and controlling the power state of the machine.

NOTE THAT CERTAIN DISTROS MAY INSTALL openipmi BY DEFAULT, INSTEAD OF ipmitool, WHICH PROVIDES DIFFERENT COMMAND-LINE OPTIONS AND IS NOT SUPPORTED BY THIS DRIVER.

class ironic.drivers.modules.ipmitool.IPMIConsole(*args, **kwargs)[source]

Bases: ConsoleInterface

A base ConsoleInterface that uses ipmitool.

get_properties()[source]

Return the properties of the interface.

Returns:

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

validate(task)[source]

Validate the Node console info.

Parameters:

task – a task from TaskManager.

Raises:

InvalidParameterValue

Raises:

MissingParameterValue when a required parameter is missing

class ironic.drivers.modules.ipmitool.IPMIManagement(*args, **kwargs)[source]

Bases: ManagementInterface

detect_vendor(task)[source]

Detects and returns the hardware vendor.

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.

get_boot_device(task)[source]

Get the current boot device for the task’s node.

Returns the current boot device of the node.

Parameters:

task – a task from TaskManager.

Raises:

InvalidParameterValue if required IPMI parameters are missing.

Raises:

IPMIFailure on an error from ipmitool.

Raises:

MissingParameterValue if a required parameter is missing.

Returns:

a dictionary containing:

boot_device:

the 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_properties()[source]

Return the properties of the interface.

Returns:

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

get_sensors_data(task)[source]

Get sensors data.

Parameters:

task – a TaskManager instance.

Raises:

FailedToGetSensorData when getting the sensor data fails.

Raises:

FailedToParseSensorData when parsing sensor data fails.

Raises:

InvalidParameterValue if required ipmi parameters are missing

Raises:

MissingParameterValue if a required parameter is missing.

Returns:

returns a dict of sensor data group by sensor type.

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.

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:

IPMIFailure on an error from ipmitool.

Returns:

None

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

Set the boot device for the task’s 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 required ipmi parameters are missing.

Raises:

IPMIFailure on an error from ipmitool.

validate(task)[source]

Check that ‘driver_info’ contains IPMI credentials.

Validates whether the ‘driver_info’ property of the supplied task’s node contains the required credentials information.

Parameters:

task – a task from TaskManager.

Raises:

InvalidParameterValue if required IPMI parameters are missing.

Raises:

MissingParameterValue if a required parameter is missing.

class ironic.drivers.modules.ipmitool.IPMIPower(*args, **kwargs)[source]

Bases: PowerInterface

get_power_state(task)[source]

Get the current power state of the task’s node.

Parameters:

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

Returns:

one of ironic.common.states POWER_OFF, POWER_ON or ERROR.

Raises:

InvalidParameterValue if required ipmi parameters are missing.

Raises:

MissingParameterValue if a required parameter is missing.

Raises:

IPMIFailure on an error from ipmitool (from _power_status call).

get_properties()[source]

Return the properties of the interface.

Returns:

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

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. currently not used.

Returns:

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

reboot(task, timeout=None)[source]

Cycles the power to the task’s node.

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

  • timeout – timeout (in seconds) positive integer (> 0) for any power state. The timeout is counted once during power off and once during power on for reboots. None indicates that the default timeout will be used.

Raises:

MissingParameterValue if required ipmi parameters are missing.

Raises:

InvalidParameterValue if an invalid power state was specified.

Raises:

PowerStateFailure if the final state of the node is not POWER_ON or the intermediate state of the node is not POWER_OFF.

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

Turn the power on, off, soft reboot, or soft power off.

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

  • power_state – desired power state. one of ironic.common.states, POWER_ON, POWER_OFF, SOFT_POWER_OFF, or SOFT_REBOOT.

  • timeout – timeout (in seconds) positive integer (> 0) for any power state. The timeout is counted once during power off and once during power on for reboots. None indicates that the default timeout will be used.

Raises:

InvalidParameterValue if an invalid power state was specified.

Raises:

MissingParameterValue if required ipmi parameters are missing

Raises:

PowerStateFailure if the power couldn’t be set to pstate.

validate(task)[source]

Validate driver_info for ipmitool driver.

Check that node[‘driver_info’] contains IPMI credentials.

Parameters:

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

Raises:

InvalidParameterValue if required ipmi parameters are missing.

Raises:

MissingParameterValue if a required parameter is missing.

class ironic.drivers.modules.ipmitool.IPMIShellinaboxConsole(*args, **kwargs)[source]

Bases: IPMIConsole

A ConsoleInterface that uses ipmitool and shellinabox.

get_console(task)[source]

Get the type and connection information about the console.

start_console(task)[source]

Start a remote console for the node.

Parameters:

task – a task from TaskManager

Raises:

InvalidParameterValue if required ipmi parameters are missing

Raises:

PasswordFileFailedToCreate if unable to create a file containing the password

Raises:

ConsoleError if the directory for the PID file cannot be created

Raises:

ConsoleSubprocessFailed when invoking the subprocess failed

stop_console(task)[source]

Stop the remote console session for the node.

Parameters:

task – a task from TaskManager

Raises:

ConsoleError if unable to stop the console

class ironic.drivers.modules.ipmitool.IPMISocatConsole(*args, **kwargs)[source]

Bases: IPMIConsole

A ConsoleInterface that uses ipmitool and socat.

get_console(task)[source]

Get the type and connection information about the console.

Parameters:

task – a task from TaskManager

start_console(task)[source]

Start a remote console for the node.

Parameters:

task – a task from TaskManager

Raises:

InvalidParameterValue if required ipmi parameters are missing

Raises:

PasswordFileFailedToCreate if unable to create a file containing the password

Raises:

ConsoleError if the directory for the PID file cannot be created

Raises:

ConsoleSubprocessFailed when invoking the subprocess failed

stop_console(task)[source]

Stop the remote console session for the node.

Parameters:

task – a task from TaskManager

Raises:

ConsoleError if unable to stop the console

class ironic.drivers.modules.ipmitool.VendorPassthru(*args, **kwargs)[source]

Bases: VendorInterface

bmc_reset(task, http_method, warm=True)[source]

Reset BMC with IPMI command ‘bmc reset (warm|cold)’.

Parameters:
  • task – a TaskManager instance.

  • http_method – the HTTP method used on the request.

  • warm – boolean parameter to decide on warm or cold reset.

Raises:

IPMIFailure on an error from ipmitool.

Raises:

MissingParameterValue if a required parameter is missing.

Raises:

InvalidParameterValue when an invalid value is specified

get_properties()[source]

Return the properties of the interface.

Returns:

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

send_raw(task, **kwargs)[source]

Send raw bytes to the BMC. Bytes should be a string of bytes.

Parameters:
  • task – a TaskManager instance.

  • raw_bytes – a string of raw bytes to send, e.g. ‘0x00 0x01’ supplied as a kwargument.

Raises:

IPMIFailure on an error from ipmitool.

Raises:

MissingParameterValue if a required parameter is missing.

Raises:

InvalidParameterValue when an invalid value is specified.

validate(task, method, **kwargs)[source]

Validate vendor-specific actions.

If invalid, raises an exception; otherwise returns None.

Valid methods:
  • send_raw

  • bmc_reset

Parameters:
  • task – a task from TaskManager.

  • method – method to be validated

  • kwargs – info for action.

Raises:

InvalidParameterValue when an invalid parameter value is specified.

Raises:

MissingParameterValue if a required parameter is missing.

ironic.drivers.modules.ipmitool.check_cipher_suite_errors(cmd_stderr)[source]

Checks if the command stderr contains cipher suite errors.

Parameters:

cmd_stderr – The command stderr.

Returns:

True if the cmd_stderr contains a cipher suite error, False otherwise.

ironic.drivers.modules.ipmitool.choose_cipher_suite(actual_cipher_suite)[source]

Gives the possible next available cipher suite version.

Based on CONF.ipmi.cipher_suite_versions and the last cipher suite version used that failed. This function is only called if the node doesn’t have cipher_suite set. Starts using the last element of the list and decreasing the index.

Parameters:

actual_cipher_suite – latest cipher suite used in the ipmi call.

Returns:

the next possible cipher suite or None in case of empty configuration.

ironic.drivers.modules.ipmitool.dump_sdr(task, file_path)[source]

Dump SDR data to a file.

Parameters:
  • task – a TaskManager instance.

  • file_path – the path to SDR dump file.

Raises:

IPMIFailure on an error from ipmitool.

Raises:

MissingParameterValue if a required parameter is missing.

Raises:

InvalidParameterValue when an invalid value is specified.

ironic.drivers.modules.ipmitool.is_bridging_enabled(node)[source]

Check if IPMI bridging is enabled.

This call is used in the inspector lookup.

ironic.drivers.modules.ipmitool.send_raw(task, raw_bytes)[source]

Send raw bytes to the BMC. Bytes should be a string of bytes.

Parameters:
  • task – a TaskManager instance.

  • raw_bytes – a string of raw bytes to send, e.g. ‘0x00 0x01’

Returns:

a tuple with stdout and stderr.

Raises:

IPMIFailure on an error from ipmitool.

Raises:

MissingParameterValue if a required parameter is missing.

Raises:

InvalidParameterValue when an invalid value is specified.

ironic.drivers.modules.ipmitool.update_cipher_suite_cmd(actual_cs, args)[source]

Updates variables and the cipher suite cmd.

This function updates the values for all parameters so they can be used in the next retry of _exec_ipmitool.

Parameters:
  • actual_cs – a string that represents the cipher suite that was used in the command.

  • args – a list that contains the ipmitool command that was executed, it will be modified in-place.

Returns:

the next actual_cs