ironic.drivers.modules.deploy_utils.
agent_add_clean_params
(task)[source]¶Add required config parameters to node’s driver_internal_info.
Adds the required conf options to node’s driver_internal_info. It is Required to pass the information to IPA.
Parameters: | task – a TaskManager instance. |
---|
ironic.drivers.modules.deploy_utils.
agent_execute_clean_step
(task, step)[source]¶Execute a clean step asynchronously on the agent.
#TODO(JoshNang) move to BootInterface
Parameters: |
|
---|---|
Raises: | NodeCleaningFailure if the agent does not return a command status |
Returns: | states.CLEANWAIT to signify the step will be completed async |
ironic.drivers.modules.deploy_utils.
agent_get_clean_steps
(task, interface=None, override_priorities=None)[source]¶Get the list of cached clean steps from the agent.
#TODO(JoshNang) move to BootInterface
The clean steps cache is updated at the beginning of cleaning.
Parameters: |
|
---|---|
Raises: | NodeCleaningFailure – if the clean steps are not yet cached, for example, when a node has just been enrolled and has not been cleaned yet. |
Returns: | A list of clean step dictionaries |
ironic.drivers.modules.deploy_utils.
build_agent_options
(node)[source]¶Build the options to be passed to the agent ramdisk.
Parameters: | node – an ironic node object |
---|---|
Returns: | a dictionary containing the parameters to be passed to agent ramdisk. |
ironic.drivers.modules.deploy_utils.
build_instance_info_for_deploy
(task)[source]¶Build instance_info necessary for deploying to a node.
Parameters: | task – a TaskManager object containing the node |
---|---|
Returns: | a dictionary containing the properties to be updated in instance_info |
Raises: | exception.ImageRefValidationFailed if image_source is not Glance href and is not HTTP(S) URL. |
ironic.drivers.modules.deploy_utils.
cache_instance_image
(ctx, node, force_raw=True)[source]¶Fetch the instance’s image from Glance
This method pulls the AMI and writes them to the appropriate place on local disk.
Parameters: |
|
---|---|
Returns: | a tuple containing the uuid of the image and the path in the filesystem where image is cached. |
ironic.drivers.modules.deploy_utils.
check_file_system_for_iscsi_device
(portal_address, portal_port, target_iqn)[source]¶Ensure the file system sees the iSCSI block device.
ironic.drivers.modules.deploy_utils.
check_for_missing_params
(info_dict, error_msg, param_prefix='')[source]¶Check for empty params in the provided dictionary.
Parameters: |
|
---|---|
Raises: | MissingParameterValue, if one or more parameters are empty in the provided dictionary. |
ironic.drivers.modules.deploy_utils.
check_interface_capability
(interface, capability)[source]¶Evaluate interface to determine if capability is present.
Parameters: |
|
---|---|
Returns: | True if capability found, otherwise False. |
ironic.drivers.modules.deploy_utils.
compute_image_checksum
(image_path, algorithm='md5')[source]¶Compute checksum by given image path and algorithm.
ironic.drivers.modules.deploy_utils.
delete_iscsi
(portal_address, portal_port, target_iqn)[source]¶Delete the iSCSI target.
ironic.drivers.modules.deploy_utils.
deploy_disk_image
(address, port, iqn, lun, image_path, node_uuid, configdrive=None, conv_flags=None)[source]¶All-in-one function to deploy a whole disk image to a node.
Parameters: |
|
---|---|
Returns: | a dictionary containing the key ‘disk identifier’ to identify the disk which was used for deployment. |
ironic.drivers.modules.deploy_utils.
deploy_partition_image
(address, port, iqn, lun, image_path, root_mb, swap_mb, ephemeral_mb, ephemeral_format, node_uuid, preserve_ephemeral=False, configdrive=None, boot_option=None, boot_mode='bios', disk_label=None, cpu_arch='')[source]¶All-in-one function to deploy a partition image to a node.
Parameters: |
|
---|---|
Raises: | InstanceDeployFailure if image virtual size is bigger than root partition size. |
Returns: | a dictionary containing the following keys: ‘root uuid’: UUID of root partition ‘efi system partition uuid’: UUID of the uefi system partition (if boot mode is uefi). NOTE: If key exists but value is None, it means partition doesn’t exist. |
ironic.drivers.modules.deploy_utils.
destroy_http_instance_images
(node)[source]¶Delete instance image file and symbolic link refers to it.
ironic.drivers.modules.deploy_utils.
destroy_images
(node_uuid)[source]¶Delete instance’s image file.
Parameters: | node_uuid – the uuid of the ironic node. |
---|
ironic.drivers.modules.deploy_utils.
direct_deploy_should_convert_raw_image
(node)[source]¶Whether converts image to raw format for specified node.
Parameters: | node – ironic node object |
---|---|
Returns: | Boolean, whether the direct deploy interface should convert image to raw. |
ironic.drivers.modules.deploy_utils.
discovery
(portal_address, portal_port)[source]¶Do iSCSI discovery on portal.
ironic.drivers.modules.deploy_utils.
fetch_images
(ctx, cache, images_info, force_raw=True)[source]¶Check for available disk space and fetch images using ImageCache.
Parameters: |
|
---|---|
Raises: | InstanceDeployFailure if unable to find enough disk space |
ironic.drivers.modules.deploy_utils.
force_iscsi_lun_update
(target_iqn)[source]¶force iSCSI initiator to re-read luns.
ironic.drivers.modules.deploy_utils.
get_async_step_return_state
(node)[source]¶Returns state based on operation (cleaning/deployment) being invoked
Parameters: | node – an ironic node object. |
---|---|
Returns: | states.CLEANWAIT if cleaning operation in progress or states.DEPLOYWAIT if deploy operation in progress. |
ironic.drivers.modules.deploy_utils.
get_boot_option
(node)[source]¶Gets the boot option.
Parameters: | node – A single Node. |
---|---|
Raises: | InvalidParameterValue if the capabilities string is not a dict or is malformed. |
Returns: | A string representing the boot option type. Defaults to ‘netboot’. |
ironic.drivers.modules.deploy_utils.
get_default_boot_option
()[source]¶Gets the default boot option.
ironic.drivers.modules.deploy_utils.
get_dev
(address, port, iqn, lun)[source]¶Returns a device path for given parameters.
ironic.drivers.modules.deploy_utils.
get_disk_label
(node)[source]¶Return the disk label requested for deploy, if any.
Parameters: | node – a single Node. |
---|---|
Raises: | InvalidParameterValue if the capabilities string is not a dictionary or is malformed. |
Returns: | the disk label or None if no disk label was specified. |
ironic.drivers.modules.deploy_utils.
get_image_instance_info
(node)[source]¶Gets the image information from the node.
Get image information for the given node instance from its ‘instance_info’ property.
Parameters: | node – a single Node. |
---|---|
Returns: | A dict with required image properties retrieved from node’s ‘instance_info’. |
Raises: | MissingParameterValue, if image_source is missing in node’s instance_info. Also raises same exception if kernel/ramdisk is missing in instance_info for non-glance images. |
ironic.drivers.modules.deploy_utils.
get_ironic_api_url
()[source]¶Resolve Ironic API endpoint
either from config of from Keystone catalog.
ironic.drivers.modules.deploy_utils.
get_pxe_boot_file
(node)[source]¶Return the PXE boot file name requested for deploy.
This method returns PXE boot file name to be used for deploy. Architecture specific boot file is searched first. BIOS/UEFI boot file is used if no valid architecture specific file found.
Parameters: | node – A single Node. |
---|---|
Returns: | The PXE boot file name. |
ironic.drivers.modules.deploy_utils.
get_pxe_config_template
(node)[source]¶Return the PXE config template file name requested for deploy.
This method returns PXE config template file to be used for deploy. First specific pxe template is searched in the node. After that architecture specific template file is searched. BIOS/UEFI template file is used if no valid architecture specific file found.
Parameters: | node – A single Node. |
---|---|
Returns: | The PXE config template file name. |
ironic.drivers.modules.deploy_utils.
get_remote_boot_volume
(task)[source]¶Identify a boot volume from any configured volumes.
Returns: | None or the volume target representing the volume. |
---|
ironic.drivers.modules.deploy_utils.
get_single_nic_with_vif_port_id
(task)[source]¶Returns the MAC address of a port which has a VIF port id.
Parameters: | task – a TaskManager instance containing the ports to act on. |
---|---|
Returns: | MAC address of the port connected to deployment network. None if it cannot find any port with vif id. |
ironic.drivers.modules.deploy_utils.
is_iscsi_boot
(task)[source]¶Return true if booting from an iscsi volume.
ironic.drivers.modules.deploy_utils.
login_iscsi
(portal_address, portal_port, target_iqn)[source]¶Login to an iSCSI target.
ironic.drivers.modules.deploy_utils.
logout_iscsi
(portal_address, portal_port, target_iqn)[source]¶Logout from an iSCSI target.
ironic.drivers.modules.deploy_utils.
parse_instance_info
(node)[source]¶Gets the instance specific Node deployment info.
This method validates whether the ‘instance_info’ property of the supplied node contains the required information for this driver to deploy images to the node.
Parameters: | node – a single Node. |
---|---|
Returns: | A dict with the instance_info values. |
Raises: | MissingParameterValue, if any of the required parameters are missing. |
Raises: | InvalidParameterValue, if any of the parameters have invalid value. |
ironic.drivers.modules.deploy_utils.
populate_storage_driver_internal_info
(task)[source]¶Set node driver_internal_info for boot from volume parameters.
Parameters: | task – a TaskManager object containing the node. |
---|---|
Raises: | StorageError when a node has an iSCSI or FibreChannel boot volume defined but is not capable to support it. |
ironic.drivers.modules.deploy_utils.
prepare_inband_cleaning
(task, manage_boot=True)[source]¶Prepares the node to boot into agent for in-band cleaning.
This method does the following: 1. Prepares the cleaning ports for the bare metal node and updates the clean parameters in node’s driver_internal_info. 2. If ‘manage_boot’ parameter is set to true, it also calls the ‘prepare_ramdisk’ method of boot interface to boot the agent ramdisk. 3. Reboots the bare metal node.
Parameters: |
|
---|---|
Returns: | states.CLEANWAIT to signify an asynchronous prepare. |
Raises: | NetworkError, NodeCleaningFailure if the previous cleaning ports cannot be removed or if new cleaning ports cannot be created. |
Raises: | InvalidParameterValue if cleaning network UUID config option has an invalid value. |
ironic.drivers.modules.deploy_utils.
set_async_step_flags
(node, reboot=None, skip_current_step=None, polling=None)[source]¶Sets appropriate reboot flags in driver_internal_info based on operation
Parameters: |
|
---|
ironic.drivers.modules.deploy_utils.
set_failed_state
(task, msg, collect_logs=True)[source]¶Sets the deploy status as failed with relevant messages.
This method sets the deployment as fail with the given message. It sets node’s provision_state to DEPLOYFAIL and updates last_error with the given error message. It also powers off the baremetal node.
Parameters: |
|
---|
ironic.drivers.modules.deploy_utils.
switch_pxe_config
(path, root_uuid_or_disk_id, boot_mode, is_whole_disk_image, trusted_boot=False, iscsi_boot=False, ramdisk_boot=False, ipxe_enabled=False)[source]¶Switch a pxe config from deployment mode to service mode.
Parameters: |
|
---|
ironic.drivers.modules.deploy_utils.
tear_down_inband_cleaning
(task, manage_boot=True)[source]¶Tears down the environment setup for in-band cleaning.
This method does the following: 1. Powers off the bare metal node (unless the node is fast tracked or there was a cleaning failure). 2. If ‘manage_boot’ parameter is set to true, it also calls the ‘clean_up_ramdisk’ method of boot interface to clean up the environment that was set for booting agent ramdisk. 3. Deletes the cleaning ports which were setup as part of cleaning.
Parameters: |
|
---|---|
Raises: | NetworkError, NodeCleaningFailure if the cleaning ports cannot be removed. |
ironic.drivers.modules.deploy_utils.
tear_down_storage_configuration
(task)[source]¶Clean up storage configuration.
Remove entries from driver_internal_info for storage and deletes the volume targets from the database. This is done to ensure a clean state for the next boot of the machine.
ironic.drivers.modules.deploy_utils.
try_set_boot_device
(task, device, persistent=True)[source]¶Tries to set the boot device on the node.
This method tries to set the boot device on the node to the given boot device. Under uefi boot mode, setting of boot device may differ between different machines. IPMI does not work for setting boot devices in uefi mode for certain machines. This method ignores the expected IPMI failure for uefi boot mode and just logs a message. In error cases, it is expected the operator has to manually set the node to boot from the correct device.
Parameters: |
|
---|---|
Raises: | Any exception from set_boot_device except IPMIFailure (setting of boot device using ipmi is expected to fail). |
ironic.drivers.modules.deploy_utils.
validate_capabilities
(node)[source]¶Validates that specified supported capabilities have valid value
This method checks if the any of the supported capability is present in Node capabilities. For all supported capabilities specified for a Node, it validates that it has a valid value. The node can have capability as part of the ‘properties’ or ‘instance_info’ or both. Note that the actual value of a capability does not need to be the same in the node’s ‘properties’ and ‘instance_info’.
Parameters: | node – an ironic node object. |
---|---|
Raises: | InvalidParameterValue, if the capability is not set to a valid value. |
ironic.drivers.modules.deploy_utils.
validate_image_properties
(ctx, deploy_info, properties)[source]¶Validate the image.
For Glance images it checks that the image exists in Glance and its properties or deployment info contain the properties passed. If it’s not a Glance image, it checks that deployment info contains needed properties.
Parameters: |
|
---|---|
Raises: | InvalidParameterValue if: * connection to glance failed; * authorization for accessing image failed; * HEAD request to image URL failed or returned response code != 200; * HEAD request response does not contain Content-Length header; * the protocol specified in image URL is not supported. |
Raises: | MissingParameterValue if the image doesn’t contain the mentioned properties. |
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.