ironic.drivers.modules.iscsi_deploy module

class ironic.drivers.modules.iscsi_deploy.ISCSIDeploy(*args, **kwargs)[source]

Bases: ironic.drivers.modules.agent_base.AgentDeployMixin, ironic.drivers.modules.agent_base.AgentBaseMixin, ironic.drivers.base.DeployInterface

iSCSI Deploy Interface for deploy-related actions.

clean_up(task)[source]

Clean up the deployment environment for the task’s node.

Unlinks TFTP and instance images and triggers image cache cleanup. Removes the TFTP configuration files for this node.

Parameters

task – a TaskManager instance containing the node to act on.

continue_deploy(task)[source]

Method invoked when deployed using iSCSI.

This method is invoked during a heartbeat from an agent when the node is in wait-call-back state. This deploys the image on the node and then configures the node to boot according to the desired boot option (netboot or localboot).

Parameters
  • task – a TaskManager object containing the node.

  • kwargs – the kwargs passed from the heartbeat method.

Raises

InstanceDeployFailure, if it encounters some error during the deploy.

deploy(task)[source]

Start deployment of the task’s node.

Fetches instance image, updates the DHCP port options for next boot, and issues a reboot request to the power driver. This causes the node to boot into the deployment ramdisk and triggers the next phase of PXE-based deployment via agent heartbeats.

Parameters

task – a TaskManager instance containing the node to act on.

Returns

deploy state DEPLOYWAIT.

get_properties()[source]

Return the properties of the interface.

Returns

dictionary of <property name>:<property description> entries.

prepare(task)[source]

Prepare the deployment environment for this task’s node.

Generates the TFTP configuration for PXE-booting both the deployment and user images, fetches the TFTP image from Glance and add it to the local cache.

Parameters

task – a TaskManager instance containing the node to act on.

Raises

NetworkError: if the previous cleaning ports cannot be removed or if new cleaning ports cannot be created.

Raises

InvalidParameterValue when the wrong power state is specified or the wrong driver info is specified for power management.

Raises

StorageError If the storage driver is unable to attach the configured volumes.

Raises

other exceptions by the node’s power driver if something wrong occurred during the power action.

Raises

any boot interface’s prepare_ramdisk exceptions.

validate(task)[source]

Validate the deployment information for the task’s node.

Parameters

task – a TaskManager instance containing the node to act on.

Raises

InvalidParameterValue.

Raises

MissingParameterValue

ironic.drivers.modules.iscsi_deploy.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.iscsi_deploy.check_image_size(task)[source]

Check if the requested image is larger than the root partition size.

Does nothing for whole-disk images.

Parameters

task – a TaskManager instance containing the node to act on.

Raises

InstanceDeployFailure if size of the image is greater than root partition.

ironic.drivers.modules.iscsi_deploy.continue_deploy(task, **kwargs)[source]

Resume a deployment upon getting POST data from deploy ramdisk.

This method raises no exceptions because it is intended to be invoked asynchronously as a callback from the deploy ramdisk.

Parameters
  • task – a TaskManager instance containing the node to act on.

  • kwargs – the kwargs to be passed to deploy.

Raises

InvalidState if the event is not allowed by the associated state machine.

Returns

a dictionary containing the following keys:

For partition image:

  • ’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.

For whole disk image:

  • ’disk identifier’: ID of the disk to which image was deployed.

ironic.drivers.modules.iscsi_deploy.delete_iscsi(portal_address, portal_port, target_iqn)[source]

Delete the iSCSI target.

ironic.drivers.modules.iscsi_deploy.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
  • address – The iSCSI IP address.

  • port – The iSCSI port number.

  • iqn – The iSCSI qualified name.

  • lun – The iSCSI logical unit number.

  • image_path – Path for the instance’s disk image.

  • node_uuid – node’s uuid.

  • configdrive – Optional. Base64 encoded Gzipped configdrive content or configdrive HTTP URL.

  • conv_flags – Optional. Add a flag that will modify the behaviour of the image copy to disk.

Returns

a dictionary containing the key ‘disk identifier’ to identify the disk which was used for deployment.

ironic.drivers.modules.iscsi_deploy.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
  • address – The iSCSI IP address.

  • port – The iSCSI port number.

  • iqn – The iSCSI qualified name.

  • lun – The iSCSI logical unit number.

  • image_path – Path for the instance’s disk image.

  • root_mb – Size of the root partition in megabytes.

  • swap_mb – Size of the swap partition in megabytes.

  • ephemeral_mb – Size of the ephemeral partition in megabytes. If 0, no ephemeral partition will be created.

  • ephemeral_format – The type of file system to format the ephemeral partition.

  • node_uuid – node’s uuid. Used for logging.

  • preserve_ephemeral – If True, no filesystem is written to the ephemeral block device, preserving whatever content it had (if the partition table has not changed).

  • configdrive – Optional. Base64 encoded Gzipped configdrive content or configdrive HTTP URL.

  • boot_option – Can be “local” or “netboot”. “netboot” by default.

  • boot_mode – Can be “bios” or “uefi”. “bios” by default.

  • disk_label – The disk label to be used when creating the partition table. Valid values are: “msdos”, “gpt” or None; If None ironic will figure it out according to the boot_mode parameter.

  • cpu_arch – Architecture of the node being deployed to.

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.iscsi_deploy.discovery(portal_address, portal_port)[source]

Do iSCSI discovery on portal.

ironic.drivers.modules.iscsi_deploy.do_agent_iscsi_deploy(task, agent_client)[source]

Method invoked when deployed with the agent ramdisk.

This method is invoked by drivers for doing iSCSI deploy using agent ramdisk. This method assumes that the agent is booted up on the node and is heartbeating.

Parameters
  • task – a TaskManager object containing the node.

  • agent_client – an instance of agent_client.AgentClient which will be used during iscsi deploy (for exposing node’s target disk via iSCSI, for install boot loader, etc).

Returns

a dictionary containing the following keys:

For partition image:

  • ’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.

For whole disk image:

  • ’disk identifier’: ID of the disk to which image was deployed.

Raises

InstanceDeployFailure if it encounters some error during the deploy.

ironic.drivers.modules.iscsi_deploy.force_iscsi_lun_update(target_iqn)[source]

force iSCSI initiator to re-read luns.

ironic.drivers.modules.iscsi_deploy.get_deploy_info(node, address, iqn, port=None, lun='1', conv_flags=None)[source]

Returns the information required for doing iSCSI deploy in a dictionary.

Parameters
  • node – ironic node object

  • address – iSCSI address

  • iqn – iSCSI iqn for the target disk

  • port – iSCSI port, defaults to one specified in the configuration

  • lun – iSCSI lun, defaults to ‘1’

  • conv_flags – flag that will modify the behaviour of the image copy to disk.

Raises

MissingParameterValue, if some required parameters were not passed.

Raises

InvalidParameterValue, if any of the parameters have invalid value.

ironic.drivers.modules.iscsi_deploy.login_iscsi(portal_address, portal_port, target_iqn)[source]

Login to an iSCSI target.

ironic.drivers.modules.iscsi_deploy.logout_iscsi(portal_address, portal_port, target_iqn)[source]

Logout from an iSCSI target.

ironic.drivers.modules.iscsi_deploy.validate(task)[source]

Validates the pre-requisites for iSCSI deploy.

Validates whether node in the task provided has some ports enrolled. This method validates whether conductor url is available either from CONF file or from keystone.

Parameters

task – a TaskManager instance containing the node to act on.

Raises

InvalidParameterValue if the URL of the Ironic API service is not configured in config file and is not accessible via Keystone catalog.

Raises

MissingParameterValue if no ports are enrolled for the given node.

ironic.drivers.modules.iscsi_deploy.verify_iscsi_connection(target_iqn)[source]

Verify iscsi connection.