ironic_python_agent.hardware.
BlockDevice
(name, model, size, rotational, wwn=None, serial=None, vendor=None, wwn_with_extension=None, wwn_vendor_extension=None, hctl=None, by_path=None)[source]¶Bases: ironic_python_agent.encoding.SerializableComparable
serializable_fields
= ('name', 'model', 'size', 'rotational', 'wwn', 'serial', 'vendor', 'wwn_with_extension', 'wwn_vendor_extension', 'hctl', 'by_path')¶ironic_python_agent.hardware.
BootInfo
(current_boot_mode, pxe_interface=None)[source]¶Bases: ironic_python_agent.encoding.SerializableComparable
serializable_fields
= ('current_boot_mode', 'pxe_interface')¶ironic_python_agent.hardware.
CPU
(model_name, frequency, count, architecture, flags=None)[source]¶Bases: ironic_python_agent.encoding.SerializableComparable
serializable_fields
= ('model_name', 'frequency', 'count', 'architecture', 'flags')¶ironic_python_agent.hardware.
GenericHardwareManager
[source]¶Bases: ironic_python_agent.hardware.HardwareManager
HARDWARE_MANAGER_NAME
= 'generic_hardware_manager'¶HARDWARE_MANAGER_VERSION
= '1.1'¶apply_configuration
(node, ports, raid_config, delete_existing=True)[source]¶Apply RAID configuration.
node – A dictionary of the node object.
ports – A list of dictionaries containing information of ports for the node.
raid_config – The configuration to apply.
delete_existing – Whether to delete the existing configuration.
collect_lldp_data
(interface_names)[source]¶Collect and convert LLDP info from the node.
In order to process the LLDP information later, the raw data needs to be converted for serialization purposes.
interface_names – list of names of node’s interfaces.
a dict, containing the lldp data from every interface.
create_configuration
(node, ports)[source]¶Create a RAID configuration.
Unless overwritten by a local hardware manager, this method will create a software RAID configuration as read from the node’s ‘target_raid_config’.
node – A dictionary of the node object.
ports – A list of dictionaries containing information of ports for the node.
The current RAID configuration in the usual format.
SoftwareRAIDError if the desired configuration is not valid or if there was an error when creating the RAID devices.
delete_configuration
(node, ports)[source]¶Delete a RAID configuration.
Unless overwritten by a local hardware manager, this method will delete all software RAID devices on the node. NOTE(arne_wiebalck): It may be worth considering to only delete RAID devices in the node’s ‘target_raid_config’. If that config has been lost, though, the cleanup may become difficult. So, for now, we delete everything we detect.
node – A dictionary of the node object
ports – A list of dictionaries containing information of ports for the node
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.
This interface could be called concurrently to speed up erasure, as such, it should be implemented in a thread-safe way.
node – Ironic node object
block_device – a BlockDevice indicating a device to be erased.
IncompatibleHardwareMethodError – when there is no known way to erase the block device
BlockDeviceEraseError – when there is an error erasing the block device
erase_devices_metadata
(node, ports)[source]¶Attempt to erase the disk devices metadata.
node – Ironic node object
ports – list of Ironic port objects
BlockDeviceEraseError – when there’s an error erasing the block device
get_bios_given_nic_name
(interface_name)[source]¶Collect the BIOS given NICs name.
This function uses the biosdevname utility to collect the BIOS given name of network interfaces.
The collected data is added to the network interface inventory with an
extra field named biosdevname
.
interface_name – list of names of node’s interfaces.
the BIOS given NIC name of node’s interfaces or default as None.
get_bmc_address
()[source]¶Attempt to detect BMC IP address
IP address of lan channel or 0.0.0.0 in case none of them is configured properly
get_bmc_v6address
()[source]¶Attempt to detect BMC v6 address
IPv6 address of lan channel or ::/0 in case none of them is configured properly. May return None value if it cannot interract with system tools or critical error occurs.
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:
{
'interface': the name of the driver interface that should execute
the step.
'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.
node – Ironic node object
ports – list of Ironic port objects
a list of cleaning steps, where each step is described as a dict as defined above
get_deploy_steps
(node, ports)[source]¶Get a list of deploy steps with priority.
Returns a list of steps. Each step is represented by a dict:
{
'interface': the name of the driver interface that should execute
the step.
'step': the HardwareManager function to call.
'priority': the order steps will be run in. Ironic will sort all
the deploy 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 deployment
automatically, but may be requested via deploy
templates.
'reboot_requested': Whether the agent should request Ironic reboots
the node via the power driver after the
operation completes.
'argsinfo': arguments specification.
}
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 deploy step is supported for the node.
node – Ironic node object
ports – list of Ironic port objects
a list of deploying steps, where each step is described as a dict as defined above
get_ipv6_addr
(interface_id)[source]¶Get the default IPv6 address assigned to the interface.
With different networking environment, the address could be a link-local address, ULA or something else.
list_block_devices
(include_partitions=False)[source]¶List physical block devices
include_partitions – If to include partitions
A list of BlockDevices
validate_configuration
(raid_config, node)[source]¶Validate a (software) RAID configuration
Validate a given raid_config, in particular with respect to the limitations of the current implementation of software RAID support.
raid_config – The current RAID configuration in the usual format.
write_image
(node, ports, image_info, configdrive=None)[source]¶A deploy step to write an image.
Downloads and writes an image to disk if necessary. Also writes a configdrive to disk if the configdrive parameter is specified.
node – A dictionary of the node object
ports – A list of dictionaries containing information of ports for the node
image_info – Image information dictionary.
configdrive – A string containing the location of the config drive as a URL OR the contents (as gzip/base64) of the configdrive. Optional, defaults to None.
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.
This interface could be called concurrently to speed up erasure, as such, it should be implemented in a thread-safe way.
node – Ironic node object
block_device – a BlockDevice indicating a device to be erased.
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.
node – Ironic node object
ports – list of Ironic port objects
a dictionary in the form {device.name: erasure output}
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:
{
'interface': the name of the driver interface that should execute
the step.
'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.
node – Ironic node object
ports – list of Ironic port objects
a list of cleaning steps, where each step is described as a dict as defined above
get_deploy_steps
(node, ports)[source]¶Get a list of deploy steps with priority.
Returns a list of steps. Each step is represented by a dict:
{
'interface': the name of the driver interface that should execute
the step.
'step': the HardwareManager function to call.
'priority': the order steps will be run in. Ironic will sort all
the deploy 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 deployment
automatically, but may be requested via deploy
templates.
'reboot_requested': Whether the agent should request Ironic reboots
the node via the power driver after the
operation completes.
'argsinfo': arguments specification.
}
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 deploy step is supported for the node.
node – Ironic node object
ports – list of Ironic port objects
a list of deploying steps, where each step is described as a dict as defined above
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.
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
(include_partitions=False)[source]¶List physical block devices
include_partitions – If to include partitions
A list of BlockDevices
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.
GENERIC
= 1¶MAINLINE
= 2¶NONE
= 0¶SERVICE_PROVIDER
= 3¶ironic_python_agent.hardware.
Memory
(total, physical_mb=None)[source]¶Bases: ironic_python_agent.encoding.SerializableComparable
serializable_fields
= ('total', 'physical_mb')¶ironic_python_agent.hardware.
NetworkInterface
(name, mac_addr, ipv4_address=None, ipv6_address=None, has_carrier=True, lldp=None, vendor=None, product=None, client_id=None, biosdevname=None)[source]¶Bases: ironic_python_agent.encoding.SerializableComparable
serializable_fields
= ('name', 'mac_address', 'ipv4_address', 'ipv6_address', 'has_carrier', 'lldp', 'vendor', 'product', 'client_id', 'biosdevname')¶ironic_python_agent.hardware.
SystemVendorInfo
(product_name, serial_number, manufacturer)[source]¶Bases: ironic_python_agent.encoding.SerializableComparable
serializable_fields
= ('product_name', 'serial_number', 'manufacturer')¶ironic_python_agent.hardware.
cache_node
(node)[source]¶Store the node object in the hardware module.
Stores the node object in the hardware module to facilitate the access of a node information in the hardware extensions.
If the new node does not match the previously cached one, wait for the expected root device to appear.
node – Ironic node object
wait_for_disks – Default True switch to wait for disk setup to be completed so the node information can be aligned with the physical storage devices of the host. This is likely to be used in unit testing.
ironic_python_agent.hardware.
check_versions
(provided_version=None)[source]¶Ensure the version of hardware managers hasn’t changed.
provided_version – Hardware manager versions used by ironic.
errors.VersionMismatch if any hardware manager version on the currently running agent doesn’t match the one stored in provided_version.
None
ironic_python_agent.hardware.
deduplicate_steps
(candidate_steps)[source]¶Remove duplicated clean or deploy steps
Deduplicates steps returned from HardwareManagers to prevent running a given step more than once. Other than individual step priority, it doesn’t actually impact the deployment which specific steps are kept and what HardwareManager they are associated with. However, in order to make testing easier, this method returns deterministic results.
Uses the following filtering logic to decide which 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.
candidate_steps – A dict containing all possible steps from all managers, key=manager, value=list of steps
A deduplicated dictionary of {hardware_manager: [steps]}
ironic_python_agent.hardware.
dispatch_to_all_managers
(method, *args, **kwargs)[source]¶Dispatch a method to all hardware managers.
Dispatches the given method in priority order as sorted by get_managers. If the method doesn’t exist or raises IncompatibleHardwareMethodError, it continues to the next hardware manager. All managers that have hardware support for this node will be called, and their responses will be added to a dictionary of the form {HardwareManagerClassName: response}.
method – hardware manager method to dispatch
args – arguments to dispatched method
kwargs – keyword arguments to dispatched method
errors.HardwareManagerMethodNotFound – if all managers raise IncompatibleHardwareMethodError.
a dictionary with keys for each hardware manager that returns a response and the value as a list of results from that hardware manager.
ironic_python_agent.hardware.
dispatch_to_managers
(method, *args, **kwargs)[source]¶Dispatch a method to best suited hardware manager.
Dispatches the given method in priority order as sorted by get_managers. If the method doesn’t exist or raises IncompatibleHardwareMethodError, it is attempted again with a more generic hardware manager. This continues until a method executes that returns any result without raising an IncompatibleHardwareMethodError.
method – hardware manager method to dispatch
args – arguments to dispatched method
kwargs – keyword arguments to dispatched method
result of successful dispatch of method
HardwareManagerMethodNotFound – if all managers failed the method
HardwareManagerNotFound – if no valid hardware managers found
ironic_python_agent.hardware.
get_cached_node
()[source]¶Guard function around the module variable NODE.
ironic_python_agent.hardware.
get_current_versions
()[source]¶Fetches versions from all hardware managers.
Dict in the format {name: version} containing one entry for every hardware manager.
ironic_python_agent.hardware.
get_holder_disks
(raid_device)[source]¶Get the holder disks of a Software RAID device.
Examine an md device and return its underlying disks.
raid_device – A Software RAID block device name.
A list of the holder disks.
ironic_python_agent.hardware.
get_managers
()[source]¶Get a list of hardware managers in priority order.
Use stevedore to find all eligible hardware managers, sort them based on self-reported (via evaluate_hardware_support()) priorities, and return them in a list. The resulting list is cached in _global_managers.
Priority-sorted list of hardware managers
HardwareManagerNotFound – if no valid hardware managers found
ironic_python_agent.hardware.
is_md_device
(raid_device)[source]¶Check if a device is an md device
Check if a device is a Software RAID (md) device.
raid_device – A Software RAID block device name.
True if the device is an md device, False otherwise.
ironic_python_agent.hardware.
list_all_block_devices
(block_type='disk', ignore_raid=False, ignore_floppy=True, ignore_empty=True)[source]¶List all physical block devices
The switches we use for lsblk: P for KEY=”value” output, b for size output in bytes, i to ensure ascii characters only, and o to specify the fields/columns we need.
Broken out as its own function to facilitate custom hardware managers that don’t need to subclass GenericHardwareManager.
block_type – Type of block device to find
ignore_raid – Ignore auto-identified raid devices, example: md0 Defaults to false as these are generally disk devices and should be treated as such if encountered.
ignore_floppy – Ignore floppy disk devices in the block device list. By default, these devices are filtered out.
ignore_empty – Whether to ignore disks with size equal 0.
A list of BlockDevices
ironic_python_agent.hardware.
list_hardware_info
(use_cache=True)[source]¶List hardware information with caching.
ironic_python_agent.hardware.
md_get_raid_devices
()[source]¶Get all discovered Software RAID (md) devices
A python dict containing details about the discovered RAID devices
ironic_python_agent.hardware.
md_restart
(raid_device)[source]¶Restart an md device
Stop and re-assemble a Software RAID (md) device.
raid_device – A Software RAID block device name.
CommandExecutionError in case the restart fails.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.