ironic.drivers.modules.iscsi_deploy module¶
-
class
ironic.drivers.modules.iscsi_deploy.
AgentDeployMixin
[source]¶ Bases:
ironic.drivers.modules.agent_base_vendor.AgentDeployMixin
-
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.
-
-
class
ironic.drivers.modules.iscsi_deploy.
ISCSIDeploy
[source]¶ Bases:
ironic.drivers.modules.iscsi_deploy.AgentDeployMixin
,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.
-
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.
-
execute_clean_step
(task, step)[source]¶ Execute a clean step asynchronously on the agent.
- Parameters
task – a TaskManager object containing the node
step – a clean step dictionary to execute
- Raises
NodeCleaningFailure if the agent does not return a command status
- Returns
states.CLEANWAIT to signify the step will be completed asynchronously.
-
get_clean_steps
(task)[source]¶ Get the list of clean steps from the agent.
- Parameters
task – a TaskManager object containing the node
- Raises
NodeCleaningFailure – if the clean steps are not yet available (cached), for example, when a node has just been enrolled and has not been cleaned yet.
- Returns
A list of clean step dictionaries.
-
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.
-
prepare_cleaning
(task)[source]¶ Boot into the agent to prepare for cleaning.
- Parameters
task – a TaskManager object containing the node
- Raises
NodeCleaningFailure – if the previous cleaning ports cannot be removed or if new cleaning ports cannot be created
- Returns
states.CLEANWAIT to signify an asynchronous prepare.
-
take_over
(task)[source]¶ Take over management of this task’s node from a dead conductor.
If conductors’ hosts maintain a static relationship to nodes, this method should be implemented by the driver to allow conductors to perform the necessary work during the remapping of nodes to conductors when a conductor joins or leaves the cluster.
- For example, the PXE driver has an external dependency:
Neutron must forward DHCP BOOT requests to a conductor which has prepared the tftpboot environment for the given node. When a conductor goes offline, another conductor must change this setting in Neutron as part of remapping that node’s control to itself. This is performed within the takeover method.
- Parameters
task – A TaskManager instance containing the node to act on.
-
tear_down
(task)[source]¶ Tear down a previous deployment on the task’s node.
Power off the node. All actual clean-up is done in the clean_up() method which should be called separately.
- Parameters
task – a TaskManager instance containing the node to act on.
- Returns
deploy state DELETED.
- Raises
NetworkError if the cleaning ports cannot be removed.
- Raises
InvalidParameterValue when the wrong state is specified or the wrong driver info is specified.
- Raises
StorageError when volume detachment fails.
- Raises
other exceptions by the node’s power driver if something wrong occurred during the power action.
-
tear_down_cleaning
(task)[source]¶ Clean up the PXE and DHCP files after cleaning.
- Parameters
task – a TaskManager object containing the node
- Raises
NodeCleaningFailure – if the cleaning ports cannot be removed
-
-
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.
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.
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.
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.