ironic.drivers.utils module¶
- class ironic.drivers.utils.MixinVendorInterface(*args, **kwargs)[source]¶
- Bases: - 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, label=None)[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. 
- label – A string to label the log file such as a clean step name. 
 
 
- 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_agent_iso(node, mode='deploy', deprecated_prefix=None)[source]¶
- Get the agent ISO image. 
- ironic.drivers.utils.get_agent_kernel_ramdisk(node, mode='deploy', deprecated_prefix=None)[source]¶
- Get the agent kernel/ramdisk as a dictionary. - Get the agent kernel/ramdisk for a given $mode. This code enforces 
- ironic.drivers.utils.get_field(node, name, deprecated_prefix=None, use_conf=False, collection='driver_info')[source]¶
- Get a driver_info field with deprecated prefix. 
- ironic.drivers.utils.get_kernel_append_params(node, default)[source]¶
- Get the applicable kernel params. - The locations are checked in this order: - The node’s instance_info. 
- The node’s driver_info. 
- Configuration. 
 - Parameters:
- node – Node object. 
- default – Default value. 
 
 
- 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.get_verify_ca(node, verify_ca)[source]¶
- Add verify_ca setting to driver_info if needed. - This function checks if verify_ca needs to be set based on configuration values and existing driver_info settings. - Parameters:
- node – The node object 
- verify_ca – The verify_ca settings in driver_info 
 
- Returns:
- Updated verify_ca setting if needed 
 
- ironic.drivers.utils.need_prepare_ramdisk(node)[source]¶
- Check if node needs preparing ramdisk - Parameters:
- node – Node to check for 
- Returns:
- True if need to prepare ramdisk, otherwise False 
 
- 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.power_off_and_on(task)[source]¶
- A context manager that handles a reboot. - If disable_power_off is False, the node is powered off before yielding and powered back on afterwards. Otherwise, one reboot is issued in the end. 
- ironic.drivers.utils.remove_node_capability(task, name)[source]¶
- Remove ‘capability’ from node’s ‘capabilities’ property. - If ‘capability’ is empty, do nothing. - Parameters:
- task – Task object. 
- capability – Capability key. 
 
 
- 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. 
 
