The ironic_python_agent.hardware Module

class ironic_python_agent.hardware.BlockDevice(name, model, size, rotational, wwn=None, serial=None, vendor=None, wwn_with_extension=None, wwn_vendor_extension=None)[source]

Bases: ironic_python_agent.encoding.SerializableComparable

class ironic_python_agent.hardware.BootInfo(current_boot_mode, pxe_interface=None)[source]

Bases: ironic_python_agent.encoding.SerializableComparable

class ironic_python_agent.hardware.CPU(model_name, frequency, count, architecture, flags=None)[source]

Bases: ironic_python_agent.encoding.SerializableComparable

class ironic_python_agent.hardware.GenericHardwareManager[source]

Bases: ironic_python_agent.hardware.HardwareManager

erase_block_device(node, block_device)[source]
erase_devices_metadata(node, ports)[source]

Attempt to erase the disk devices metadata.

Parameters:
  • node – Ironic node object
  • ports – list of Ironic port objects
:raises BlockDeviceEraseError when there’s an error erasing the
block device
evaluate_hardware_support()[source]
get_bmc_address()[source]
get_boot_info()[source]
get_clean_steps(node, ports)[source]
get_cpus()[source]
get_ipv4_addr(interface_id)[source]
get_memory()[source]
get_os_install_device()[source]
get_system_vendor_info()[source]
list_block_devices()[source]
list_network_interfaces()[source]
class ironic_python_agent.hardware.HardwareManager[source]

Bases: object

erase_block_device(node, block_device)[source]

Attempt to erase a block device.

Implementations should detect the type of device and erase it in the most appropriate way possible. Generic implementations should support common erase mechanisms such as ATA secure erase, or multi-pass random writes. Operators with more specific needs should override this method in order to detect and handle “interesting” cases, or delegate to the parent class to handle generic cases.

For example: operators running ACME MagicStore (TM) cards alongside standard SSDs might check whether the device is a MagicStore and use a proprietary tool to erase that, otherwise call this method on their parent class. Upstream submissions of common functionality are encouraged.

Parameters:
  • node – Ironic node object
  • block_device – a BlockDevice indicating a device to be erased.
Raises:
  • IncompatibleHardwareMethodError – when there is no known way to erase the block device
  • BlockDeviceEraseError – when there is an error erasing the block device
erase_devices(node, ports)[source]

Erase any device that holds user data.

By default this will attempt to erase block devices. This method can be overridden in an implementation-specific hardware manager in order to erase additional hardware, although backwards-compatible upstream submissions are encouraged.

Parameters:
  • node – Ironic node object
  • ports – list of Ironic port objects
Returns:

a dictionary in the form {device.name: erasure output}

evaluate_hardware_support()[source]
get_bmc_address()[source]
get_boot_info()[source]
get_clean_steps(node, ports)[source]

Get a list of clean steps with priority.

Returns a list of steps. Each step is represented by a dict:

{
 'step': the HardwareManager function to call.
 'priority': the order steps will be run in. Ironic will sort all
             the clean steps from all the drivers, with the largest
             priority step being run first. If priority is set to 0,
             the step will not be run during cleaning, but may be
             run during zapping.
 'reboot_requested': Whether the agent should request Ironic reboots
                     the node via the power driver after the
                     operation completes.
 'abortable': Boolean value. Whether the clean step can be
              stopped by the operator or not. Some clean step may
              cause non-reversible damage to a machine if interrupted
              (i.e firmware update), for such steps this parameter
              should be set to False. If no value is set for this
              parameter, Ironic will consider False (non-abortable).
}

If multiple hardware managers return the same step name, the following logic will be used to determine which manager’s step “wins”:

  • Keep the step that belongs to HardwareManager with highest HardwareSupport (larger int) value.
  • If equal support level, keep the step with the higher defined priority (larger int).
  • If equal support level and priority, keep the step associated with the HardwareManager whose name comes earlier in the alphabet.

The steps will be called using hardware.dispatch_to_managers and handled by the best suited hardware manager. If you need a step to be executed by only your hardware manager, ensure it has a unique step name.

node and ports can be used by other hardware managers to further determine if a clean step is supported for the node.

Parameters:
  • node – Ironic node object
  • ports – list of Ironic port objects
Returns:

a list of cleaning steps, where each step is described as a dict as defined above

get_cpus()[source]
get_memory()[source]
get_os_install_device()[source]
get_version()[source]

Get a name and version for this hardware manager.

In order to avoid errors and make agent upgrades painless, cleaning will check the version of all hardware managers during get_clean_steps at the beginning of cleaning and before executing each step in the agent.

The agent isn’t aware of the steps being taken before or after via out of band steps, so it can never know if a new step is safe to run. Therefore, we default to restarting the whole process.

Returns:a dictionary with two keys: name and version, where name is a string identifying the hardware manager and version is an arbitrary version string. name will be a class variable called HARDWARE_MANAGER_NAME, or default to the class name and version will be a class variable called HARDWARE_MANAGER_VERSION or default to ‘1.0’.
list_block_devices()[source]
list_hardware_info()[source]

Return full hardware inventory as a serializable dict.

This inventory is sent to Ironic on lookup and to Inspector on inspection.

Returns:a dictionary representing inventory
list_network_interfaces()[source]
class ironic_python_agent.hardware.HardwareSupport[source]

Bases: object

Example priorities for hardware managers.

Priorities for HardwareManagers are integers, where largest means most specific and smallest means most generic. These values are guidelines that suggest values that might be returned by calls to evaluate_hardware_support(). No HardwareManager in mainline IPA will ever return a value greater than MAINLINE. Third party hardware managers should feel free to return values of SERVICE_PROVIDER or greater to distinguish between additional levels of hardware support.

class ironic_python_agent.hardware.HardwareType[source]

Bases: object

class ironic_python_agent.hardware.Memory(total, physical_mb=None)[source]

Bases: ironic_python_agent.encoding.SerializableComparable

class ironic_python_agent.hardware.NetworkInterface(name, mac_addr, ipv4_address=None, has_carrier=True, lldp=None, vendor=None, product=None)[source]

Bases: ironic_python_agent.encoding.SerializableComparable

class ironic_python_agent.hardware.SystemVendorInfo(product_name, serial_number, manufacturer)[source]

Bases: ironic_python_agent.encoding.SerializableComparable

Previous topic

The ironic_python_agent.extensions.standby Module

Next topic

The ironic_python_agent.inspector Module

Project Source

This Page