ironic.conductor.utils module

ironic.conductor.utils module

ironic.conductor.utils.abort_on_conductor_take_over(*args, **kwargs)[source]

Set node’s state when a task was aborted due to conductor take over.

Parameters:task – a TaskManager instance.
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(*args, **kwargs)[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(*args, **kwargs)[source]

Cleanup rescue task after timeout.

Parameters:task – a TaskManager instance.
ironic.conductor.utils.deploying_error_handler(task, logmsg, errmsg, traceback=False, clean_up=True)[source]

Put a failed node in DEPLOYFAIL.

Parameters:
  • task – the task
  • logmsg – message to be logged
  • errmsg – message for the user
  • traceback – Boolean; True to log a traceback
  • clean_up – Boolean; True to clean up
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(*args, **kwargs)[source]

Change power state or reset for a node.

Perform the requested power action if the transition is required.

Parameters:
  • task – a TaskManager instance containing the node to act on.
  • new_state – Any power state from ironic.common.states.
  • timeout – timeout (in seconds) positive integer (> 0) for any power state. None indicates to use default timeout.
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(*args, **kwargs)[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:
  • task – a TaskManager instance.
  • device – Boot device. Values are vendor-specific.
  • persistent – Whether to set next-boot, or make the change permanent. Default: False.
Raises:

InvalidParameterValue if the validation of the ManagementInterface fails.

ironic.conductor.utils.node_set_boot_mode(*args, **kwargs)[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:
  • task – a TaskManager instance.
  • new_state – the desired new power state, one of the power states in ironic.common.states.
  • timeout – number of seconds to wait before giving up. If not specified, uses the conductor.power_state_change_timeout config value.
Raises:

PowerStateFailure if timed out

ironic.conductor.utils.notify_conductor_resume_clean(task)[source]
ironic.conductor.utils.notify_conductor_resume_deploy(task)[source]
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:
  • e – the exception object that was raised.
  • node – an Ironic node object.
  • power_state – the power state to set on the node.
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:
  • e – the exception object that was raised.
  • node – an Ironic node object.
  • provision_state – the provision state to be set on the node.
  • target_provision_state – the target provision state to be set on the node.
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:
  • node – an Ironic node object.
  • save – Boolean; True (default) to save the node; False otherwise.
ironic.conductor.utils.rescuing_error_handler(task, msg, set_fail_state=True)[source]

Cleanup rescue task after timeout or failure.

Parameters:
  • task – a TaskManager instance.
  • msg – a message to set into node’s last_error field
  • set_fail_state – a boolean flag to indicate if node needs to be transitioned to a failed state. By default node would be transitioned to a failed state.
ironic.conductor.utils.set_node_cleaning_steps(task)[source]

Set up the node with clean step information for cleaning.

For automated cleaning, get the clean steps from the driver. For manual cleaning, the user’s clean steps are known but need to be validated against the driver’s clean steps.

Raises:InvalidParameterValue if there is a problem with the user’s clean steps.
Raises:NodeCleaningFailure if there was a problem getting the clean steps.
ironic.conductor.utils.set_node_deployment_steps(task)[source]

Set up the node with deployment step information for deploying.

Get the deploy steps from the driver.

Raises:InstanceDeployFailure if there was a problem getting the deployment steps.
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.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(*args, **kwargs)[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 the portgroup has existing ports with different physical networks, we raise PortgroupPhysnetInconsistent. This shouldn’t ever happen.
  • If the port has a physical network that is inconsistent with other ports in the portgroup, we raise exception.Conflict.

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:
  • task – a TaskManager instance
  • port_obj – a port object to be validated.
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.

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.