ipmi

IPMI module.

TODO: replace with pyghmi.

class spicerack.ipmi.Ipmi(password)[source]

Bases: object

Class to manage remote IPMI via ipmitool.

__init__(password)[source]

Initialize the instance.

Parameters:password (str) -- the password to use to connect via IPMI.
_get_boot_parameter(mgmt_hostname, param_label)[source]

Get a specific boot parameter of the host.

Parameters:
  • mgmt_hostname (str) -- the FQDN of the management interface of the host to target.
  • param_label (str) -- the label of the boot parameter to lookout for.
Raises:

spicerack.ipmi.IpmiError -- if unable to find the given label or to extract its value.

Returns:

the value of the parameter.

Return type:

str

check_bootparams(mgmt_hostname)[source]

Check if the BIOS boot parameters are back to normal values.

Parameters:mgmt_hostname (str) -- the FQDN of the management interface of the host to target.
Raises:spicerack.ipmi.IpmiCheckError -- if the BIOS boot parameters are incorrect.
check_connection(mgmt_hostname)[source]

Ensure that remote IPMI is working for the managment console hostname.

Parameters:mgmt_hostname (str) -- the FQDN of the management interface of the host to target.
Raises:spicerack.ipmi.IpmiError -- if unable to connect or execute a test command.
command(mgmt_hostname, command_parts)[source]

Run an ipmitool command for a remote managment console hostname.

Parameters:
  • mgmt_hostname (str) -- the FQDN of the management interface of the host to target.
  • command_parts (list) -- a list with the IPMI command components to execute.
Returns:

the output of the ipmitool command.

Return type:

str

Raises:

spicerack.ipmi.IpmiError -- on failure.

force_pxe(mgmt_hostname)[source]

Force PXE for the next boot and verify that the setting was applied.

Parameters:mgmt_hostname (str) -- the FQDN of the management interface of the host to target.
Raises:spicerack.ipmi.IpmiCheckError -- if unable to verify the PXE mode within the retries.
exception spicerack.ipmi.IpmiCheckError[source]

Bases: spicerack.exceptions.SpicerackCheckError

Custom exception class for check errors of the Ipmi class.

exception spicerack.ipmi.IpmiError[source]

Bases: spicerack.exceptions.SpicerackError

Custom exception class for errors of the Ipmi class.