ironic.drivers.modules.ilo.common module¶
Common functionalities shared between different iLO modules.
- ironic.drivers.modules.ilo.common.POST_FINISHEDPOST_STATE = 'FinishedPost'¶
Node is in FinishedPost post state.
- ironic.drivers.modules.ilo.common.POST_INPOSTDISCOVERY_STATE = 'InPostDiscoveryComplete'¶
Node is in InPostDiscoveryComplete post state.
- ironic.drivers.modules.ilo.common.POST_INPOST_STATE = 'InPost'¶
Node is in InPost post state.
- ironic.drivers.modules.ilo.common.POST_NULL_STATE = 'Null'¶
Node is in Null post state.
- ironic.drivers.modules.ilo.common.POST_POWEROFF_STATE = 'PowerOff'¶
Node is in PowerOff post state.
- ironic.drivers.modules.ilo.common.POST_RESET_STATE = 'Reset'¶
Node is in Reset post state.
- ironic.drivers.modules.ilo.common.POST_UNKNOWN_STATE = 'Unknown'¶
Node is in Unknown post state.
- ironic.drivers.modules.ilo.common.SUPPORTED_BOOT_MODE_LEGACY_BIOS_AND_UEFI = 'legacy bios and uefi'¶
Node supports both legacy BIOS and UEFI boot mode.
- ironic.drivers.modules.ilo.common.SUPPORTED_BOOT_MODE_LEGACY_BIOS_ONLY = 'legacy bios only'¶
Node supports only legacy BIOS boot mode.
- ironic.drivers.modules.ilo.common.SUPPORTED_BOOT_MODE_UEFI_ONLY = 'uefi only'¶
Node supports only UEFI boot mode.
- ironic.drivers.modules.ilo.common.add_certificates(task, cert_file_list=None)[source]¶
Adds certificates to the node.
Adds certificates to the node based on the driver info provided.
- Parameters:
task – a TaskManager instance containing the node to act on.
cert_file_list – List of certificates to be added to the node. If None, certificates from path configured in ‘webserver_verify_ca’ will be added to the node.
- Raises:
IloOperationError on an error from IloClient library.
- Raises:
IloOperationNotSupported if retrieving post state is not supported on the server.
- Raises:
InvalidParameterValue, if any of the required parameters are invalid.
- ironic.drivers.modules.ilo.common.attach_vmedia(node, device, url)[source]¶
Attaches the given url as virtual media on the node.
- Parameters:
node – an ironic node object.
device – the virtual media device to attach
url – the http/https url to attach as the virtual media device
- Raises:
IloOperationError if insert virtual media failed.
- ironic.drivers.modules.ilo.common.cleanup_vmedia_boot(task)[source]¶
Cleans a node after a virtual media boot.
This method cleans up a node after a virtual media boot. It deletes the floppy image if it exists in CONF.ilo.swift_ilo_container or web server. It also ejects both virtual media cdrom and virtual media floppy.
- Parameters:
task – a TaskManager instance containing the node to act on.
- ironic.drivers.modules.ilo.common.clear_certificates(task, cert_file_list=None)[source]¶
Clears any certificates added to the node.
Clears the certificates added to the node as part of any Ironic operation
- Parameters:
task – a TaskManager instance containing the node to act on.
cert_file_list – List of certificates to be removed from node. If None, all the certificates present on the node will be removed.
- Raises:
IloOperationError on an error from IloClient library.
- Raises:
IloOperationNotSupported if retrieving post state is not supported on the server.
- ironic.drivers.modules.ilo.common.copy_image_to_swift(source_file_path, destination_object_name)[source]¶
Uploads the given image to swift.
This method copies the given image to swift.
- Parameters:
source_file_path – The absolute path of the image file which needs to be copied to swift.
destination_object_name – The name of the object that will contain the copied image.
- Raises:
SwiftOperationError, if any operation with Swift fails.
- Returns:
temp url from swift after the source image is uploaded.
- ironic.drivers.modules.ilo.common.copy_image_to_web_server(source_file_path, destination)[source]¶
Copies the given image to the http web server.
This method copies the given image to the http_root location. It enables read-write access to the image else the deploy fails as the image file at the web_server url is inaccessible.
- Parameters:
source_file_path – The absolute path of the image file which needs to be copied to the web server root.
destination – The name of the file that will contain the copied image.
- Raises:
ImageUploadFailed exception if copying the source file to the web server fails.
- Returns:
image url after the source image is uploaded.
- ironic.drivers.modules.ilo.common.destroy_floppy_image_from_web_server(node)[source]¶
Removes the temporary floppy image.
It removes the floppy image created for deploy. :param node: an ironic node object.
- ironic.drivers.modules.ilo.common.download(target_file, file_url)[source]¶
Downloads file based on the scheme.
It downloads the file (url) to given location. The supported url schemes are file, http, and https. :param target_file: target file for copying the downloaded file. :param file_url: source file url from where file needs to be downloaded. :raises: ImageDownloadFailed, on failure to download the file.
- ironic.drivers.modules.ilo.common.eject_vmedia_devices(task)[source]¶
Ejects virtual media devices.
This method ejects virtual media floppy and cdrom.
- Parameters:
task – a TaskManager instance containing the node to act on.
- Returns:
None
- Raises:
IloOperationError, if some error was encountered while trying to eject virtual media floppy or cdrom.
- ironic.drivers.modules.ilo.common.get_current_boot_mode(node)[source]¶
Get the current boot mode for a node.
- Parameters:
node – an ironic node object.
- Raises:
IloOperationError if failed to fetch boot mode.
- Raises:
IloOperationNotSupported if node does not support getting pending boot mode.
- ironic.drivers.modules.ilo.common.get_ilo_object(node)[source]¶
Gets an IloClient object from proliantutils library.
Given an ironic node object, this method gives back a IloClient object to do operations on the iLO.
- Parameters:
node – an ironic node object.
- Returns:
an IloClient object.
- Raises:
InvalidParameterValue on invalid inputs.
- Raises:
MissingParameterValue if some mandatory information is missing on the node
- ironic.drivers.modules.ilo.common.get_secure_boot_mode(task)[source]¶
Retrieves current enabled state of UEFI secure boot on the node
Returns the current enabled state of UEFI secure boot on the node.
- Parameters:
task – a task from TaskManager.
- Raises:
MissingParameterValue if a required iLO parameter is missing.
- Raises:
IloOperationError on an error from IloClient library.
- Raises:
IloOperationNotSupported if UEFI secure boot is not supported.
- Returns:
Boolean value indicating current state of UEFI secure boot on the node.
- ironic.drivers.modules.ilo.common.get_server_post_state(node)[source]¶
Get the current state of system POST.
- Parameters:
node – an ironic node object.
- Returns:
POST state of the server. The valida states are:- null, Unknown, Reset, PowerOff, InPost, InPostDiscoveryComplete and FinishedPost.
- Raises:
IloOperationError on an error from IloClient library.
- Raises:
IloOperationNotSupported if retrieving post state is not supported on the server.
- ironic.drivers.modules.ilo.common.parse_driver_info(node)[source]¶
Gets the driver specific Node info.
This method validates whether the ‘driver_info’ property of the supplied node contains the required information for this driver.
- Parameters:
node – an ironic Node object.
- Returns:
a dict containing information from driver_info (or where applicable, config values).
- Raises:
InvalidParameterValue if any parameters are incorrect
- Raises:
MissingParameterValue if some mandatory information is missing on the node
- ironic.drivers.modules.ilo.common.remove_image_from_swift(object_name, associated_with=None)[source]¶
Removes the given image from swift.
This method removes the given image name from swift. It deletes the image if it exists in CONF.ilo.swift_ilo_container
- Parameters:
object_name – The name of the object which needs to be removed from swift.
associated_with – string to depict the component/operation this object is associated to.
- ironic.drivers.modules.ilo.common.remove_image_from_web_server(object_name)[source]¶
Removes the given image from the configured web server.
This method removes the given image from the http_root location, if the image exists.
- Parameters:
object_name – The name of the image file which needs to be removed from the web server root.
- ironic.drivers.modules.ilo.common.remove_single_or_list_of_files(file_location)[source]¶
Removes (deletes) the file or list of files.
This method only accepts single or list of files to delete. If single file is passed, this method removes (deletes) the file. If list of files is passed, this method removes (deletes) each of the files iteratively.
- Parameters:
file_location – a single or a list of file paths
- ironic.drivers.modules.ilo.common.set_boot_mode(node, boot_mode)[source]¶
Sets the node to boot using boot_mode for the next boot.
- Parameters:
node – an ironic node object.
boot_mode – Next boot mode.
- Raises:
IloOperationError if setting boot mode failed.
- ironic.drivers.modules.ilo.common.set_secure_boot_mode(task, flag)[source]¶
Enable or disable UEFI Secure Boot for the next boot
Enable or disable UEFI Secure Boot for the next boot
- Parameters:
task – a task from TaskManager.
flag – Boolean value. True if the secure boot to be enabled in next boot.
- Raises:
IloOperationError on an error from IloClient library.
- Raises:
IloOperationNotSupported if UEFI secure boot is not supported.
- ironic.drivers.modules.ilo.common.setup_uefi_https(task, iso, persistent=False)[source]¶
Sets up system to boot from UEFIHTTP boot device.
Sets the one-time/persistent boot device to UEFIHTTP based on the argument supplied.
- Parameters:
task – a TaskManager instance containing the node to act on.
iso – ISO URL to be set to boot from.
persistent – Indicates whether the system should be set to boot from the given device one-time or each time.
- Raises:
IloOperationError on an error from IloClient library.
- Raises:
IloOperationNotSupported if retrieving post state is not supported on the server.
- ironic.drivers.modules.ilo.common.setup_vmedia(task, iso, ramdisk_options=None)[source]¶
Attaches virtual media and sets it as boot device.
This method attaches the given bootable ISO as virtual media, prepares the arguments for ramdisk in virtual media floppy.
- Parameters:
task – a TaskManager instance containing the node to act on.
iso –
a bootable ISO image href to attach to. Should be either of below:
A Swift object - It should be of format
swift:<object-name>
. It is assumed that the image object is present in CONF.ilo.swift_ilo_container;A Glance image - It should be format
glance://<glance-image-uuid>
or just<glance-image-uuid>
;An HTTP URL.
ramdisk_options – the options to be passed to the ramdisk in virtual media floppy.
- Raises:
ImageCreationFailed, if it failed while creating the floppy image.
- Raises:
IloOperationError, if some operation on iLO failed.
- ironic.drivers.modules.ilo.common.setup_vmedia_for_boot(task, boot_iso, parameters=None)[source]¶
Sets up the node to boot from the given ISO image.
This method attaches the given boot_iso on the node and passes the required parameters to it via virtual floppy image.
- Parameters:
task – a TaskManager instance containing the node to act on.
boot_iso –
a bootable ISO image to attach to. Should be either of below:
A Swift object - It should be of format
swift:<object-name>
. It is assumed that the image object is present in CONF.ilo.swift_ilo_container;A Glance image - It should be format
glance://<glance-image-uuid>
or just<glance-image-uuid>
;An HTTP URL.
parameters – the parameters to pass in the virtual floppy image in a dictionary. This is optional.
- Raises:
ImageCreationFailed, if it failed while creating the floppy image.
- Raises:
SwiftOperationError, if any operation with Swift fails.
- Raises:
IloOperationError, if attaching virtual media failed.
- ironic.drivers.modules.ilo.common.update_boot_mode(task)[source]¶
Update instance_info with boot mode to be used for deploy.
This method updates instance_info with boot mode to be used for deploy if node properties[‘capabilities’] do not have boot_mode. It sets the boot mode on the node.
- Parameters:
task – Task object.
- Raises:
IloOperationError if setting boot mode failed.
- ironic.drivers.modules.ilo.common.update_ipmi_properties(task)[source]¶
Update ipmi properties to node driver_info
- Parameters:
task – a task from TaskManager.
- ironic.drivers.modules.ilo.common.update_redfish_properties(task)[source]¶
Update redfish properties to node driver_info
This method updates the node’s driver info with redfish driver driver_info. :param task: a task from TaskManager.
- ironic.drivers.modules.ilo.common.validate_security_parameter_values(sec_param_info)[source]¶
Validate security parameter with valid values.
- Parameters:
sec_param_info – dict object containing the security parameter info
- Raises:
MissingParameterValue, for missing fields (or values) in security parameter info.
- Raises:
InvalidParameterValue, for unsupported security parameter
- Returns:
tuple of security param, ignore and enable parameters.
- ironic.drivers.modules.ilo.common.verify_image_checksum(image_location, expected_checksum)[source]¶
Verifies checksum of image file against the expected one.
This method generates the checksum of the image file on the fly and verifies it against the expected checksum provided as argument.
- Parameters:
image_location – location of image file whose checksum is verified.
expected_checksum – checksum to be checked against
- Raises:
ImageRefValidationFailed, if invalid file path or verification fails.