ipmi

IPMI module.

Todo

replace with pyghmi.

class spicerack.ipmi.Ipmi(password, dry_run=True)[source]

Bases: object

Class to manage remote IPMI via ipmitool.

Initialize the instance.

Parameters:
  • password (str) -- the password to use to connect via IPMI.
  • dry_run (bool, optional) -- whether this is a DRY-RUN.
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 management 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, is_safe=False)[source]

Run an ipmitool command for a remote management console hostname.

Parameters:
  • mgmt_hostname (str) -- the FQDN of the management interface of the host to target.
  • command_parts (list) -- a list of str with the IPMI command components to execute.
  • is_safe (bool, optional) -- if this is a safe command to run also in DRY RUN mode.
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.