ironic.drivers.modules.agent module¶
- class ironic.drivers.modules.agent.AgentDeploy(*args, **kwargs)[source]¶
Bases:
CustomAgentDeploy
Interface for deploy-related actions.
- configure_local_boot(task, root_uuid=None, efi_system_part_uuid=None, prep_boot_part_uuid=None)[source]¶
Helper method to configure local boot on the node.
This method triggers bootloader installation on the node. On successful installation of bootloader, this method sets the node to boot from disk.
- Parameters:
task – a TaskManager object containing the node
root_uuid – The UUID of the root partition. This is used for identifying the partition which contains the image deployed or None in case of whole disk images which we expect to already have a bootloader installed.
efi_system_part_uuid – The UUID of the efi system partition. This is used only in uefi boot mode.
prep_boot_part_uuid – The UUID of the PReP Boot partition. This is used only for booting ppc64* hardware.
- Raises:
InstanceDeployFailure if bootloader installation failed or on encountering error while setting the boot device on the node.
- prepare_instance_boot(task)[source]¶
Prepare instance for booting.
The base version only calls prepare_instance on the boot interface.
- prepare_instance_to_boot(task, root_uuid, efi_sys_uuid, prep_boot_part_uuid=None)[source]¶
Prepares instance to boot.
- Parameters:
task – a TaskManager object containing the node
root_uuid – the UUID for root partition
efi_sys_uuid – the UUID for the efi partition
- Raises:
InvalidState if fails to prepare instance
- validate(task)[source]¶
Validate the driver-specific Node deployment info.
This method validates whether the properties of the supplied node contain the required information for this driver to deploy images to the node.
- Parameters:
task – a TaskManager instance
- Raises:
MissingParameterValue, if any of the required parameters are missing.
- Raises:
InvalidParameterValue, if any of the parameters have invalid value.
- class ironic.drivers.modules.agent.AgentRAID(*args, **kwargs)[source]¶
Bases:
RAIDInterface
Implementation of RAIDInterface which uses agent ramdisk.
- apply_configuration(task, raid_config, delete_existing=True)[source]¶
Applies RAID configuration on the given node.
- Parameters:
task – A TaskManager instance.
raid_config – The RAID configuration to apply.
delete_existing – Setting this to True indicates to delete RAID configuration prior to creating the new configuration.
- Raises:
InvalidParameterValue, if the RAID configuration is invalid.
- Returns:
states.DEPLOYWAIT if RAID configuration is in progress asynchronously or None if it is complete.
- create_configuration(task, create_root_volume=True, create_nonroot_volumes=True)[source]¶
Create a RAID configuration on a bare metal using agent ramdisk.
This method creates a RAID configuration on the given node.
- Parameters:
task – a TaskManager instance.
create_root_volume – If True, a root volume is created during RAID configuration. Otherwise, no root volume is created. Default is True.
create_nonroot_volumes – If True, non-root volumes are created. If False, no non-root volumes are created. Default is True.
- Returns:
states.CLEANWAIT if operation was successfully invoked.
- Raises:
MissingParameterValue, if node.target_raid_config is missing or was found to be empty after skipping root volume and/or non-root volumes.
- delete_configuration(task)[source]¶
Deletes RAID configuration on the given node.
- Parameters:
task – a TaskManager instance.
- Returns:
states.CLEANWAIT if operation was successfully invoked
- 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_deploy_steps(task)[source]¶
Get the list of deploy steps from the agent.
- Parameters:
task – a TaskManager object containing the node
- Raises:
InstanceDeployFailure – if the deploy steps are not yet available (cached), for example, when a node has just been enrolled and has not been deployed yet.
- Returns:
A list of deploy step dictionaries
- class ironic.drivers.modules.agent.AgentRescue(*args, **kwargs)[source]¶
Bases:
RescueInterface
Implementation of RescueInterface which uses agent ramdisk.
- clean_up(task)[source]¶
Clean up after RESCUEWAIT timeout/failure or finishing rescue.
Rescue password should be removed from the node and ramdisk boot environment should be cleaned if Ironic is managing the ramdisk boot.
- Parameters:
task – a TaskManager instance with the node.
- Raises:
NetworkError if the rescue ports cannot be removed.
- rescue(task)[source]¶
Boot a rescue ramdisk on the node.
- Parameters:
task – a TaskManager instance.
- Raises:
NetworkError if the tenant ports cannot be removed.
- Raises:
InvalidParameterValue when the wrong power state is specified or the wrong driver info is specified for power management.
- 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.
- Returns:
Returns states.RESCUEWAIT
- unrescue(task)[source]¶
Attempt to move a rescued node back to active state.
- Parameters:
task – a TaskManager instance.
- Raises:
NetworkError if the rescue ports cannot be removed.
- Raises:
InvalidParameterValue when the wrong power state is specified or the wrong driver info is specified for power management.
- Raises:
other exceptions by the node’s power driver if something wrong occurred during the power action.
- Raises:
any boot interface’s prepare_instance exceptions.
- Returns:
Returns states.ACTIVE
- validate(task)[source]¶
Validate that the node has required properties for agent rescue.
- Parameters:
task – a TaskManager instance with the node being checked
- Raises:
InvalidParameterValue if ‘instance_info/rescue_password’ has empty password or rescuing network UUID config option has an invalid value.
- Raises:
MissingParameterValue if node is missing one or more required parameters
- class ironic.drivers.modules.agent.CustomAgentDeploy(*args, **kwargs)[source]¶
Bases:
AgentBaseMixin
,HeartbeatMixin
,AgentOobStepsMixin
,DeployInterface
A deploy interface that relies on a custom agent to deploy.
Only provides the basic deploy steps to start the ramdisk, tear down the ramdisk and prepare the instance boot.
- clean_up(task)[source]¶
Clean up the deployment environment for this node.
If preparation of the deployment environment ahead of time is possible, this method should be implemented by the driver. It should erase anything cached by the prepare method.
If implemented, this method must be idempotent. It may be called multiple times for the same node on the same conductor, and it may be called by multiple conductors in parallel. Therefore, it must not require an exclusive lock.
This method is called before tear_down.
- Parameters:
task – a TaskManager instance.
- deploy(task)[source]¶
Perform a deployment to a node.
Perform the necessary work to deploy an image onto the specified node. This method will be called after prepare(), which may have already performed any preparatory steps, such as pre-caching some data for the node.
- Parameters:
task – a TaskManager instance.
- Returns:
status of the deploy. One of ironic.common.states.
- execute_deploy_step(task, step)[source]¶
Execute a deploy step.
We’re trying to find a step among both out-of-band and in-band steps. In case of duplicates, out-of-band steps take priority. This property allows having an out-of-band deploy step that calls into a corresponding in-band step after some preparation (e.g. with additional input).
- Parameters:
task – a TaskManager object containing the node
step – a deploy step dictionary to execute
- Raises:
InstanceDeployFailure if the agent does not return a command status
- Returns:
states.DEPLOYWAIT to signify the step will be completed async
- get_deploy_steps(task)[source]¶
Get the list of deploy steps from the agent.
- Parameters:
task – a TaskManager object containing the node
- Raises:
InstanceDeployFailure – if the deploy steps are not yet available (cached), for example, when a node has just been enrolled and has not been deployed yet.
- Returns:
A list of deploy 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 node.
- Parameters:
task – a TaskManager instance.
- 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:
exception.ImageRefValidationFailed if image_source is not Glance href and is not HTTP(S) URL.
- Raises:
exception.InvalidParameterValue if network validation fails.
- Raises:
any boot interface’s prepare_ramdisk exceptions.
- prepare_instance_boot(task)[source]¶
Prepare instance for booting.
The base version only calls prepare_instance on the boot interface.
- tear_down_agent(task)[source]¶
A deploy step to tear down the agent.
- Parameters:
task – a TaskManager object containing the node
- validate(task)[source]¶
Validate the driver-specific Node deployment info.
This method validates whether the properties of the supplied node contain the required information for this driver to deploy images to the node.
- Parameters:
task – a TaskManager instance
- Raises:
MissingParameterValue, if any of the required parameters are missing.
- Raises:
InvalidParameterValue, if any of the parameters have invalid value.
- ironic.drivers.modules.agent.check_image_size(task)[source]¶
Check if the requested image is larger than the ram size.
- Parameters:
task – a TaskManager instance containing the node to act on.
- Raises:
InvalidParameterValue if size of the image is greater than the available ram size.
- ironic.drivers.modules.agent.soft_power_off(task, client=None)[source]¶
Power off the node using the agent API.