ironic.conductor.utils.
abort_on_conductor_take_over
(task)[source]¶Set node’s state when a task was aborted due to conductor take over.
Parameters: | task – a TaskManager instance. |
---|
ironic.conductor.utils.
add_secret_token
(node, pregenerated=False)[source]¶Adds a secret token to driver_internal_info for IPA verification.
Parameters: |
|
---|
ironic.conductor.utils.
agent_is_alive
(node, timeout=None)[source]¶Check that the agent is likely alive.
The method then checks for the last agent heartbeat, and if it occured within the timeout set by [deploy]fast_track_timeout, then agent is presumed alive.
Parameters: |
|
---|
ironic.conductor.utils.
build_configdrive
(node, configdrive)[source]¶Build a configdrive from provided meta_data, network_data and user_data.
If uuid or name are not provided in the meta_data, they’re defauled to the node’s uuid and name accordingly.
Parameters: |
|
---|---|
Returns: | A gzipped and base64 encoded configdrive as a string. |
ironic.conductor.utils.
cleaning_error_handler
(task, msg, tear_down_cleaning=True, set_fail_state=True)[source]¶Put a failed node in CLEANFAIL and maintenance.
ironic.conductor.utils.
cleanup_after_timeout
(task)[source]¶Cleanup deploy task after timeout.
Parameters: | task – a TaskManager instance. |
---|
ironic.conductor.utils.
cleanup_cleanwait_timeout
(task)[source]¶Cleanup a cleaning task after timeout.
Parameters: | task – a TaskManager instance. |
---|
ironic.conductor.utils.
cleanup_rescuewait_timeout
(task)[source]¶Cleanup rescue task after timeout.
Parameters: | task – a TaskManager instance. |
---|
ironic.conductor.utils.
deploying_error_handler
(task, logmsg, errmsg=None, traceback=False, clean_up=True)[source]¶Put a failed node in DEPLOYFAIL.
Parameters: |
|
---|
ironic.conductor.utils.
fail_on_error
(error_callback, msg, *error_args, **error_kwargs)[source]¶A decorator for failing operation on failure.
ironic.conductor.utils.
fast_track_able
(task)[source]¶Checks if the operation can be a streamlined deployment sequence.
This is mainly focused on ensuring that we are able to quickly sequence through operations if we already have a ramdisk heartbeating through external means.
Parameters: | task – Taskmanager object |
---|---|
Returns: | True if [deploy]fast_track is set to True, no iSCSI boot configuration is present, and no last_error is present for the node indicating that there was a recent failure. |
ironic.conductor.utils.
get_attached_vif
(port)[source]¶Get any attached vif ID for the port
Parameters: | port – The port object upon which to check for a vif record. |
---|---|
Returns: | Returns a tuple of the vif if found and the use of the vif in the form of a string, ‘tenant’, ‘cleaning’ ‘provisioning’, ‘rescuing’. |
Raises: | InvalidState exception upon finding a port with a transient state vif on the port. |
ironic.conductor.utils.
hash_password
(password='')[source]¶Hashes a supplied password.
Parameters: | value – Value to be hashed |
---|
ironic.conductor.utils.
is_agent_token_pregenerated
(node)[source]¶Determines if the token was generated for out of band configuration.
Ironic supports the ability to provide configuration data to the agent through the a virtual floppy or as part of the virtual media image which is attached to the BMC.
This method helps us identify WHEN we did so as we don’t need to remove records of the token prior to rebooting the token. This is important as tokens provided through out of band means presist in the virtual media image, are loaded as part of the agent ramdisk, and do not require regeneration of the token upon the initial lookup, ultimately making the overall usage of virtual media and pregenerated tokens far more secure.
Parameters: | node – Node Object |
---|---|
Returns: | True if the token was pregenerated as indicated by the node’s driver_internal_info field. False in all other cases. |
ironic.conductor.utils.
is_agent_token_present
(node)[source]¶Determines if an agent token is present upon a node.
Parameters: | node – Node object |
---|---|
Returns: | True if an agent_secret_token value is present in a node driver_internal_info field. |
ironic.conductor.utils.
is_agent_token_valid
(node, token)[source]¶Validates if a supplied token is valid for the node.
Parameters: | node – Node object |
---|---|
Token: | A token value to validate against the driver_internal_info field agent_sercret_token. |
Returns: | True if the supplied token matches the token recorded in the supplied node object. |
ironic.conductor.utils.
is_fast_track
(task)[source]¶Checks a fast track is available.
This method first ensures that the node and conductor configuration is valid to perform a fast track sequence meaning that we already have a ramdisk running through another means like discovery. If not valid, False is returned.
The method then checks for the last agent heartbeat, and if it occured within the timeout set by [deploy]fast_track_timeout and the power state for the machine is POWER_ON, then fast track is permitted.
Parameters: | task – Taskmanager object |
---|---|
Returns: | True if the last heartbeat that was recorded was within the [deploy]fast_track_timeout setting. |
ironic.conductor.utils.
make_salt
()[source]¶Generate a random salt with the indicator tag for password type.
Returns: | a valid salt for use with crypt.crypt |
---|
ironic.conductor.utils.
node_get_boot_mode
(task)[source]¶Read currently set boot mode from a node.
Reads the boot mode for a node. If boot mode can’t be discovered, None is returned.
Parameters: | task – a TaskManager instance. |
---|---|
Raises: | DriverOperationError or its derivative in case of driver runtime error. |
Raises: | UnsupportedDriverExtension if current driver does not have management interface or get_boot_mode() method is not supported. |
Returns: | Boot mode. One of ironic.common.boot_mode or None
if boot mode can’t be discovered |
ironic.conductor.utils.
node_power_action
(task, new_state, timeout=None)[source]¶Change power state or reset for a node.
Perform the requested power action if the transition is required.
Parameters: |
|
---|---|
Raises: | InvalidParameterValue when the wrong state is specified or the wrong driver info is specified. |
Raises: | StorageError when a failure occurs updating the node’s storage interface upon setting power on. |
Raises: | other exceptions by the node’s power driver if something wrong occurred during the power action. |
ironic.conductor.utils.
node_set_boot_device
(task, device, persistent=False)[source]¶Set the boot device for a node.
If the node that the boot device change is being requested for is in ADOPTING state, the boot device will not be set as that change could potentially result in the future running state of an adopted node being modified erroneously.
Parameters: |
|
---|---|
Raises: | InvalidParameterValue if the validation of the ManagementInterface fails. |
ironic.conductor.utils.
node_set_boot_mode
(task, mode)[source]¶Set the boot mode for a node.
Sets the boot mode for a node if the node’s driver interface contains a ‘management’ interface.
If the node that the boot mode change is being requested for is in ADOPTING state, the boot mode will not be set as that change could potentially result in the future running state of an adopted node being modified erroneously.
Parameters: |
|
---|---|
Raises: | InvalidParameterValue if the validation of the ManagementInterface fails. |
Raises: | DriverOperationError or its derivative in case of driver runtime error. |
Raises: | UnsupportedDriverExtension if current driver does not have vendor interface or method is unsupported. |
ironic.conductor.utils.
node_wait_for_power_state
(task, new_state, timeout=None)[source]¶Wait for node to be in new power state.
Parameters: |
|
---|---|
Raises: | PowerStateFailure if timed out |
ironic.conductor.utils.
notify_conductor_resume_operation
(task, operation)[source]¶Notify the conductor to resume an operation.
Parameters: |
|
---|
ironic.conductor.utils.
power_on_node_if_needed
(task)[source]¶Powers on node if it is powered off and has a Smart NIC port
Parameters: | task – A TaskManager object |
---|---|
Returns: | the previous power state or None if no changes were made |
Raises: | exception.NetworkError if agent status didn’t match the required status after max retry attempts. |
ironic.conductor.utils.
power_state_error_handler
(e, node, power_state)[source]¶Set the node’s power states if error occurs.
This hook gets called upon an exception being raised when spawning the worker thread to change the power state of a node.
Parameters: |
|
---|
ironic.conductor.utils.
power_state_for_network_configuration
(task)[source]¶Handle the power state for a node reconfiguration.
Powers the node on if and only if it has a Smart NIC port. Yields for the actual reconfiguration, then restores the power state.
Parameters: | task – A TaskManager object. |
---|
ironic.conductor.utils.
provisioning_error_handler
(e, node, provision_state, target_provision_state)[source]¶Set the node’s provisioning states if error occurs.
This hook gets called upon an exception being raised when spawning the worker to do some provisioning to a node like deployment, tear down, or cleaning.
Parameters: |
|
---|
ironic.conductor.utils.
remove_node_rescue_password
(node, save=True)[source]¶Helper to remove rescue password from a node.
Removes rescue password from node. It saves node by default. If node should not be saved, then caller needs to explicitly indicate it.
Parameters: |
|
---|
ironic.conductor.utils.
rescuing_error_handler
(task, msg, set_fail_state=True)[source]¶Cleanup rescue task after timeout or failure.
Parameters: |
|
---|
ironic.conductor.utils.
restore_power_state_if_needed
(task, power_state_to_restore)[source]¶Change the node’s power state if power_state_to_restore is not None
Parameters: |
|
---|
ironic.conductor.utils.
skip_automated_cleaning
(node)[source]¶Checks if node cleaning needs to be skipped for an specific node.
Parameters: | node – the node to consider |
---|
ironic.conductor.utils.
spawn_cleaning_error_handler
(e, node)[source]¶Handle spawning error for node cleaning.
ironic.conductor.utils.
spawn_deploying_error_handler
(e, node)[source]¶Handle spawning error for node deploying.
ironic.conductor.utils.
spawn_rescue_error_handler
(e, node)[source]¶Handle spawning error for node rescue.
ironic.conductor.utils.
store_agent_certificate
(node, agent_verify_ca)[source]¶Store certificate received from the agent and return its path.
ironic.conductor.utils.
validate_instance_info_traits
(node)[source]¶Validate traits in instance_info.
All traits in instance_info must also exist as node traits.
Parameters: | node – an Ironic node object. |
---|---|
Raises: | InvalidParameterValue if the instance traits are badly formatted, or contain traits that are not set on the node. |
ironic.conductor.utils.
validate_port_physnet
(task, port_obj)[source]¶Validate the consistency of physical networks of ports in a portgroup.
Validate the consistency of a port’s physical network with other ports in the same portgroup. All ports in a portgroup should have the same value (which may be None) for their physical_network field.
During creation or update of a port in a portgroup we apply the following validation criteria:
If a port’s physical network is None, this indicates that ironic’s VIF attachment mapping algorithm should operate in a legacy (physical network unaware) mode for this port or portgroup. This allows existing ironic nodes to continue to function after an upgrade to a release including physical network support.
Parameters: |
|
---|---|
Raises: | Conflict if the port is a member of a portgroup which is on a different physical network. |
Raises: | PortgroupPhysnetInconsistent if the port’s portgroup has ports which are not all assigned the same physical network. |
ironic.conductor.utils.
value_within_timeout
(value, timeout)[source]¶Checks if the time is within the previous timeout seconds from now.
Parameters: |
|
---|
ironic.conductor.utils.
wipe_cleaning_internal_info
(task)[source]¶Remove temporary cleaning fields from driver_internal_info.
ironic.conductor.utils.
wipe_deploy_internal_info
(task)[source]¶Remove temporary deployment fields from driver_internal_info.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.