ironic.drivers.utils module

ironic.drivers.utils module

class ironic.drivers.utils.MixinVendorInterface(mapping, driver_passthru_mapping=None)[source]

Bases: ironic.drivers.base.VendorInterface

Wrapper around multiple VendorInterfaces.

get_properties()[source]

Return the properties from all the VendorInterfaces.

Returns:a dictionary of <property_name>:<property_description> entries.
validate(task, method, **kwargs)[source]

Call validate on the appropriate interface only.

Raises:UnsupportedDriverExtension if ‘method’ can not be mapped to the supported interfaces.
Raises:InvalidParameterValue if ‘method’ is invalid.
Raises:MissingParameterValue if missing ‘method’ or parameters in kwargs.
ironic.drivers.utils.add_node_capability(task, capability, value)[source]

Add ‘capability’ to node’s ‘capabilities’ property.

If ‘capability’ is already present, then a duplicate entry will be added.

Parameters:
  • task – Task object.
  • capability – Capability key.
  • value – Capability value.
ironic.drivers.utils.capabilities_to_dict(capabilities)[source]

Parse the capabilities string into a dictionary

Parameters:capabilities – the capabilities of the node as a formatted string.
Raises:InvalidParameterValue if capabilities is not an string or has a malformed value
ironic.drivers.utils.collect_ramdisk_logs(node)[source]

Collect and store the system logs from the IPA ramdisk.

Collect and store the system logs from the IPA ramdisk. This method makes a call to the IPA ramdisk to collect the logs and store it according to the configured storage backend.

Parameters:node – A node object.
ironic.drivers.utils.ensure_next_boot_device(task, driver_info)[source]

Ensure boot from correct device if persistent is True

If ipmi_force_boot_device is True and is_next_boot_persistent, set to boot from correct device, else unset is_next_boot_persistent field.

Parameters:
  • task – Node object.
  • driver_info – Node driver_info.
ironic.drivers.utils.force_persistent_boot(task, device, persistent)[source]

Set persistent boot device to driver_internal_info

If persistent is True set ‘persistent_boot_device’ field to the boot device and reset persistent to False, else set ‘is_next_boot_persistent’ to False.

Parameters:
  • task – Task object.
  • device – Boot device.
  • persistent – Whether next boot is persistent or not.
ironic.drivers.utils.get_node_capability(node, capability)[source]

Returns ‘capability’ value from node’s ‘capabilities’ property.

Parameters:
  • node – Node object.
  • capability – Capability key.
Returns:

Capability value. If capability is not present, then return “None”

ironic.drivers.utils.get_node_mac_addresses(task)[source]

Get all MAC addresses for the ports belonging to this task’s node.

Parameters:task – a TaskManager instance containing the node to act on.
Returns:A list of MAC addresses in the format xx:xx:xx:xx:xx:xx.
ironic.drivers.utils.get_ramdisk_logs_file_name(node, label=None)[source]

Construct the log file name.

Parameters:
  • node – A node object.
  • label – A string to label the log file such as a clean step name.
Returns:

The log file name.

ironic.drivers.utils.normalize_mac(mac)[source]

Remove ‘-‘ and ‘:’ characters and lowercase the MAC string.

Parameters:mac – MAC address to normalize.
Returns:Normalized MAC address string.
ironic.drivers.utils.store_ramdisk_logs(node, logs, label=None)[source]

Store the ramdisk logs.

This method stores the ramdisk logs according to the configured storage backend.

Parameters:
  • node – A node object.
  • logs – A gzipped and base64 encoded string containing the logs archive.
  • label – A string to label the log file such as a clean step name.
Raises:

OSError if the directory to save the logs cannot be created.

Raises:

IOError when the logs can’t be saved to the local file system.

Raises:

SwiftOperationError, if any operation with Swift fails.

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.