ironic.api.controllers.v1.node module

class ironic.api.controllers.v1.node.BootDeviceController(*args, **kwargs)[source]

Bases: RestController

get(node_ident)[source]

Get the current boot device for a node.

Parameters:

node_ident – the UUID or logical name of a node.

Returns:

a json object containing:

boot_device:

the boot device, one of ironic.common.boot_devices or None if it is unknown.

persistent:

Whether the boot device will persist to all future boots or not, None if it is unknown.

put(node_ident, boot_device, persistent=False)[source]

Set the boot device for a node.

Set the boot device to use on next reboot of the node.

Parameters:
  • node_ident – the UUID or logical name of a node.

  • boot_device – the boot device, one of ironic.common.boot_devices.

  • persistent – Boolean value. True if the boot device will persist to all future boots, False if not. Default: False.

supported(node_ident)[source]

Get a list of the supported boot devices.

Parameters:

node_ident – the UUID or logical name of a node.

Returns:

A json object with the list of supported boot devices.

class ironic.api.controllers.v1.node.GetNodeAndTopicMixin[source]

Bases: object

class ironic.api.controllers.v1.node.IndicatorAtComponent(**kwargs)[source]

Bases: object

class ironic.api.controllers.v1.node.IndicatorController(*args, **kwargs)[source]

Bases: RestController

get_all(node_ident, **kwargs)[source]

Get node hardware components and their indicators.

Parameters:

node_ident – the UUID or logical name of a node.

Returns:

A json object of hardware components (ironic.common.components) as keys with indicator IDs (from get_supported_indicators) as values.

get_one(node_ident, indicator)[source]

Get node hardware component indicator and its state.

Parameters:
  • node_ident – the UUID or logical name of a node.

  • indicator – Indicator ID (as reported by get_supported_indicators).

Returns:

a dict with the “state” key and one of mod:ironic.common.indicator_states as a value.

put(node_ident, indicator, state)[source]

Set node hardware component indicator to the desired state.

Parameters:
  • node_ident – the UUID or logical name of a node.

  • indicator – Indicator ID (as reported by get_supported_indicators).

  • state – Indicator state, one of mod:ironic.common.indicator_states.

class ironic.api.controllers.v1.node.InjectNmiController(*args, **kwargs)[source]

Bases: RestController

put(node_ident)[source]

Inject NMI for a node.

Inject NMI (Non Maskable Interrupt) for a node immediately.

Parameters:

node_ident – the UUID or logical name of a node.

Raises:

NotFound if requested version of the API doesn’t support inject nmi.

Raises:

HTTPForbidden if the policy is not authorized.

Raises:

NodeNotFound if the node is not found.

Raises:

NodeLocked if the node is locked by another conductor.

Raises:

UnsupportedDriverExtension if the node’s driver doesn’t support management or management.inject_nmi.

Raises:

InvalidParameterValue when the wrong driver info is specified or an invalid boot device is specified.

Raises:

MissingParameterValue if missing supplied info.

class ironic.api.controllers.v1.node.NodeChildrenController(*args, **kwargs)[source]

Bases: RestController

get_all()[source]
class ironic.api.controllers.v1.node.NodeConsoleController(*args, **kwargs)[source]

Bases: RestController

get(node_ident)[source]

Get connection information about the console.

Parameters:

node_ident – UUID or logical name of a node.

put(node_ident, enabled)[source]

Start and stop the node console.

Parameters:
  • node_ident – UUID or logical name of a node.

  • enabled – Boolean value; whether to enable or disable the console.

class ironic.api.controllers.v1.node.NodeHistoryController(*args, **kwargs)[source]

Bases: RestController

detail_fields = ['uuid', 'created_at', 'severity', 'event_type', 'event', 'conductor', 'user']
get_all(detail=False, marker=None, limit=None)[source]

List node history.

get_one(event)[source]

Get a node history entry

standard_fields = ['uuid', 'created_at', 'severity', 'event']
class ironic.api.controllers.v1.node.NodeInventoryController(*args, **kwargs)[source]

Bases: RestController

get()[source]

Node inventory of the node.

Parameters:

node_ident – the UUID of a node.

class ironic.api.controllers.v1.node.NodeMaintenanceController(*args, **kwargs)[source]

Bases: RestController

delete(node_ident)[source]

Remove the node from maintenance mode.

Parameters:

node_ident – the UUID or logical name of a node.

put(node_ident, reason=None)[source]

Put the node in maintenance mode.

Parameters:
  • node_ident – the UUID or logical_name of a node.

  • reason – Optional, the reason why it’s in maintenance.

class ironic.api.controllers.v1.node.NodeManagementController(*args, **kwargs)[source]

Bases: RestController

boot_device = <ironic.api.controllers.v1.node.BootDeviceController object>

Expose boot_device as a sub-element of management

indicators = <ironic.api.controllers.v1.node.IndicatorController object>

Expose indicators as a sub-element of management

inject_nmi = <ironic.api.controllers.v1.node.InjectNmiController object>

Expose inject_nmi as a sub-element of management

class ironic.api.controllers.v1.node.NodeStatesController(*args, **kwargs)[source]

Bases: RestController

boot_mode(node_ident, target)[source]

Asynchronous set the boot mode of the node.

Parameters:
  • node_ident – the UUID or logical name of a node.

  • target – The desired boot_mode for the node (uefi/bios).

Raises:

InvalidParameterValue (HTTP 400) if the requested target state is not valid.

Raises:

NotFound (HTTP 404) if requested version of the API is less than 1.76.

Raises:

Conflict (HTTP 409) if a node is in adopting state or another transient state.

console = <ironic.api.controllers.v1.node.NodeConsoleController object>

Expose console as a sub-element of states

get(node_ident)[source]

List the states of the node.

Parameters:

node_ident – the UUID or logical_name of a node.

power(node_ident, target, timeout=None)[source]

Set the power state of the node.

Parameters:
  • node_ident – the UUID or logical name of a node.

  • target – The desired power state of the node.

  • timeout – timeout (in seconds) positive integer (> 0) for any power state. None indicates to use default timeout.

Raises:

ClientSideError (HTTP 409) if a power operation is already in progress.

Raises:

InvalidStateRequested (HTTP 400) if the requested target state is not valid or if the node is in CLEANING state.

Raises:

NotAcceptable (HTTP 406) for soft reboot, soft power off or timeout parameter, if requested version of the API is less than 1.27.

Raises:

Invalid (HTTP 400) if timeout value is less than 1.

provision(node_ident, target, configdrive=None, clean_steps=None, deploy_steps=None, rescue_password=None, disable_ramdisk=None, service_steps=None, runbook=None)[source]

Asynchronous trigger the provisioning of the node.

This will set the target provision state of the node, and a background task will begin which actually applies the state change. This call will return a 202 (Accepted) indicating the request was accepted and is in progress; the client should continue to GET the status of this node to observe the status of the requested action.

Parameters:
  • node_ident – UUID or logical name of a node.

  • target – The desired provision state of the node or verb.

  • configdrive – Optional. A gzipped and base64 encoded configdrive or a dict to build a configdrive from. Only valid when setting provision state to “active” or “rebuild”.

  • clean_steps

    An ordered list of cleaning steps that will be performed on the node. A cleaning step is a dictionary with required keys ‘interface’ and ‘step’, and optional key ‘args’. If specified, the value for ‘args’ is a keyword variable argument dictionary that is passed to the cleaning step method.:

    { 'interface': <driver_interface>,
      'step': <name_of_clean_step>,
      'args': {<arg1>: <value1>, ..., <argn>: <valuen>} }
    

    For example (this isn’t a real example, this cleaning step doesn’t exist):

    { 'interface': 'deploy',
      'step': 'upgrade_firmware',
      'args': {'force': True} }
    

    This is required (and only valid) when target is “clean”.

  • deploy_steps

    A list of deploy steps that will be performed on the node. A deploy step is a dictionary with required keys ‘interface’, ‘step’, ‘priority’ and ‘args’. If specified, the value for ‘args’ is a keyword variable argument dictionary that is passed to the deploy step method.:

    { 'interface': <driver_interface>,
      'step': <name_of_deploy_step>,
      'args': {<arg1>: <value1>, ..., <argn>: <valuen>}
      'priority': <integer>}
    

    For example (this isn’t a real example, this deploy step doesn’t exist):

    { 'interface': 'deploy',
      'step': 'upgrade_firmware',
      'args': {'force': True},
      'priority': 90 }
    

    This is used only when target is “active” or “rebuild” and is optional.

  • rescue_password – A string representing the password to be set inside the rescue environment. This is required (and only valid), when target is “rescue”.

  • disable_ramdisk – Whether to skip booting ramdisk for cleaning.

  • service_steps

    A list of service steps that will be performed on the node. A service step is a dictionary with required keys ‘interface’, ‘step’, ‘priority’ and ‘args’. If specified, the value for ‘args’ is a keyword variable argument dictionary that is passed to the service step method.:

    { 'interface': <driver_interface>,
      'step': <name_of_service_step>,
      'args': {<arg1>: <value1>, ..., <argn>: <valuen>}
      'priority': <integer>}
    

    For example (this isn’t a real example, this service step doesn’t exist):

    { 'interface': 'deploy',
      'step': 'upgrade_firmware',
      'args': {'force': True},
      'priority': 90 }
    

  • runbook – UUID or logical name of a runbook.

Raises:

NodeLocked (HTTP 409) if the node is currently locked.

Raises:

ClientSideError (HTTP 409) if the node is already being provisioned.

Raises:

InvalidParameterValue (HTTP 400), if validation of clean_steps, deploy_steps, service_steps or power driver interface fails.

Raises:

InvalidStateRequested (HTTP 400) if the requested transition is not possible from the current state.

Raises:

NodeInMaintenance (HTTP 400), if operation cannot be performed because the node is in maintenance mode.

Raises:

NoFreeConductorWorker (HTTP 503) if no workers are available.

Raises:

NotAcceptable (HTTP 406) if the API version specified does not allow the requested state transition or parameters.

raid(node_ident, target_raid_config)[source]

Set the target raid config of the node.

Parameters:
  • node_ident – the UUID or logical name of a node.

  • target_raid_config – Desired target RAID configuration of the node. It may be an empty dictionary as well.

Raises:

UnsupportedDriverExtension, if the node’s driver doesn’t support RAID configuration.

Raises:

InvalidParameterValue, if validation of target raid config fails.

Raises:

NotAcceptable, if requested version of the API is less than 1.12.

secure_boot(node_ident, target)[source]

Asynchronous set the secure_boot state of the node.

Parameters:
  • node_ident – the UUID or logical name of a node.

  • target – Should secure_boot be enabled on node (True/False).

Raises:

InvalidParameterValue (HTTP 400) if the requested target state is not valid.

Raises:

NotFound (HTTP 404) if requested version of the API is less than 1.76.

Raises:

Conflict (HTTP 409) if a node is in adopting state.

class ironic.api.controllers.v1.node.NodeTraitsController(*args, **kwargs)[source]

Bases: RestController

delete(trait=None)[source]

Remove one or all traits from a node.

Parameters:

trait – String value; trait to remove from a node, or None. If None, all traits are removed.

get_all()[source]

List node traits.

put(trait=None, body=None)[source]

Add a trait to a node.

Parameters:
  • trait – String value; trait to add to a node, or None. Mutually exclusive with ‘traits’. If not None, adds this trait to the node.

  • traits – List of Strings; traits to set for a node, or None. Mutually exclusive with ‘trait’. If not None, replaces the node’s traits with this list.

class ironic.api.controllers.v1.node.NodeVIFController(*args, **kwargs)[source]

Bases: RestController, GetNodeAndTopicMixin

delete(vif_id)[source]

Detach a VIF from this node

Parameters:

vif_id – The ID of a VIF to detach

get_all()[source]

Get a list of attached VIFs

post(vif)[source]

Attach a VIF to this node

Parameters:

vif – a dictionary of information about a VIF. It must have an ‘id’ key, whose value is a unique identifier for that VIF.

class ironic.api.controllers.v1.node.NodeVendorPassthruController(*args, **kwargs)[source]

Bases: RestController

REST controller for VendorPassthru.

This controller allow vendors to expose a custom functionality in the Ironic API. Ironic will merely relay the message from here to the appropriate driver, no introspection will be made in the message body.

methods(node_ident)[source]

Retrieve information about vendor methods of the given node.

Parameters:

node_ident – UUID or logical name of a node.

Returns:

dictionary with <vendor method name>:<method metadata> entries.

Raises:

NodeNotFound if the node is not found.

class ironic.api.controllers.v1.node.NodeVmediaController(*args, **kwargs)[source]

Bases: RestController, GetNodeAndTopicMixin

delete(device_types=None)[source]

Detach a virtual media from this node

Parameters:

device_types – A collection of device types.

get()[source]

Get virtual media details for this node

post(vmedia)[source]

Attach a virtual media to this node

Parameters:

vmedia – a dictionary of information about the attachment.

class ironic.api.controllers.v1.node.NodesController(*args, **kwargs)[source]

Bases: RestController

REST controller for Nodes.

delete(node_ident, *args)[source]

Delete a node.

Parameters:

node_ident – UUID or logical name of a node.

detail(chassis_uuid=None, instance_uuid=None, associated=None, maintenance=None, retired=None, provision_state=None, marker=None, limit=None, sort_key='id', sort_dir='asc', driver=None, resource_class=None, fault=None, conductor_group=None, conductor=None, owner=None, description_contains=None, lessee=None, project=None, shard=None, sharded=None, include_children=None, parent_node=None)[source]

Retrieve a list of nodes with detail.

Parameters:
  • chassis_uuid – Optional UUID of a chassis, to get only nodes for that chassis.

  • instance_uuid – Optional UUID of an instance, to find the node associated with that instance.

  • associated – Optional boolean whether to return a list of associated or unassociated nodes. May be combined with other parameters.

  • maintenance – Optional boolean value that indicates whether to get nodes in maintenance mode (“True”), or not in maintenance mode (“False”).

  • retired – Optional boolean value that indicates whether to get nodes which are retired.

  • provision_state – Optional string value to get only nodes in that provision state.

  • marker – pagination marker for large data sets.

  • limit – maximum number of resources to return in a single result. This value cannot be larger than the value of max_limit in the [api] section of the ironic configuration, or only max_limit resources will be returned.

  • sort_key – column to sort results by. Default: id.

  • sort_dir – direction to sort. “asc” or “desc”. Default: asc.

  • driver – Optional string value to get only nodes using that driver.

  • resource_class – Optional string value to get only nodes with that resource_class.

  • fault – Optional string value to get only nodes with that fault.

  • conductor_group – Optional string value to get only nodes with that conductor_group.

  • owner – Optional string value that set the owner whose nodes are to be retrurned.

  • lessee – Optional string value that set the lessee whose nodes are to be returned.

  • project – Optional string value that set the project - lessee or owner - whose nodes are to be returned.

  • shard – Optional - set the shards whose nodes are to be returned.

  • description_contains – Optional string value to get only nodes with description field contains matching value.

  • sharded – Optional boolean whether to return a list of nodes with or without a shard set. May be combined with other parameters.

from_chassis = False

A flag to indicate if the requests to this controller are coming from the top-level resource Chassis

get_all(chassis_uuid=None, instance_uuid=None, associated=None, maintenance=None, retired=None, provision_state=None, marker=None, limit=None, sort_key='id', sort_dir='asc', driver=None, fields=None, resource_class=None, fault=None, conductor_group=None, detail=None, conductor=None, owner=None, description_contains=None, lessee=None, project=None, shard=None, sharded=None, include_children=None, parent_node=None)[source]

Retrieve a list of nodes.

Parameters:
  • chassis_uuid – Optional UUID of a chassis, to get only nodes for that chassis.

  • instance_uuid – Optional UUID of an instance, to find the node associated with that instance.

  • associated – Optional boolean whether to return a list of associated or unassociated nodes. May be combined with other parameters.

  • maintenance – Optional boolean value that indicates whether to get nodes in maintenance mode (“True”), or not in maintenance mode (“False”).

  • retired – Optional boolean value that indicates whether to get retired nodes.

  • provision_state – Optional string value to get only nodes in that provision state.

  • marker – pagination marker for large data sets.

  • limit – maximum number of resources to return in a single result. This value cannot be larger than the value of max_limit in the [api] section of the ironic configuration, or only max_limit resources will be returned.

  • sort_key – column to sort results by. Default: id.

  • sort_dir – direction to sort. “asc” or “desc”. Default: asc.

  • driver – Optional string value to get only nodes using that driver.

  • resource_class – Optional string value to get only nodes with that resource_class.

  • conductor_group – Optional string value to get only nodes with that conductor_group.

  • conductor – Optional string value to get only nodes managed by that conductor.

  • owner – Optional string value that set the owner whose nodes are to be retrurned.

  • lessee – Optional string value that set the lessee whose nodes are to be returned.

  • project – Optional string value that set the project - lessee or owner - whose nodes are to be returned.

  • shard – Optional string value that set the shards whose nodes are to be returned.

  • fields – Optional, a list with a specified set of fields of the resource to be returned.

  • fault – Optional string value to get only nodes with that fault.

  • description_contains – Optional string value to get only nodes with description field contains matching value.

  • sharded – Optional boolean whether to return a list of nodes with or without a shard set. May be combined with other parameters.

get_one(node_ident, fields=None)[source]

Retrieve information about the given node.

Parameters:
  • node_ident – UUID or logical name of a node.

  • fields – Optional, a list with a specified set of fields of the resource to be returned.

invalid_sort_key_list = ['properties', 'driver_info', 'extra', 'instance_info', 'driver_internal_info', 'clean_step', 'deploy_step', 'raid_config', 'target_raid_config', 'traits', 'network_data', 'service_step']
maintenance = <ironic.api.controllers.v1.node.NodeMaintenanceController object>

Expose maintenance as a sub-element of nodes

management = <ironic.api.controllers.v1.node.NodeManagementController object>

Expose management as a sub-element of nodes

parent_node = None

An indicator to signal if this resource is being accessed by a sub-controller.

patch(node_ident, reset_interfaces=None, patch=None)[source]

Update an existing node.

Parameters:
  • node_ident – UUID or logical name of a node.

  • reset_interfaces – whether to reset hardware interfaces to their defaults. Only valid when updating the driver field.

  • patch – a json PATCH document to apply to this node.

post(node)[source]

Create a new node.

Parameters:

node – a node within the request body.

Example Node creation request:

{
    "name": "test_node_dynamic",
    "driver": "ipmi",
    "driver_info": {
        "ipmi_username": "ADMIN",
        "ipmi_password": "password"
    },
    "power_interface": "ipmitool",
    "resource_class": "bm-large"
}
states = <ironic.api.controllers.v1.node.NodeStatesController object>

Expose the state controller action as a sub-element of nodes

validate(node=None, node_uuid=None)[source]

Validate the driver interfaces, using the node’s UUID or name.

Note that the ‘node_uuid’ interface is deprecated in favour of the ‘node’ interface

Parameters:
  • node – UUID or name of a node.

  • node_uuid – UUID of a node.

vendor_passthru = <ironic.api.controllers.v1.node.NodeVendorPassthruController object>

A resource used for vendors to expose a custom functionality in the API

ironic.api.controllers.v1.node.get_nodes_controller_reserved_names()[source]
ironic.api.controllers.v1.node.hide_fields_in_newer_versions(obj)[source]

This method hides fields that were added in newer API versions.

Certain node fields were introduced at certain API versions. These fields are only made available when the request’s API version matches or exceeds the versions when these fields were introduced.

Add links to the indicator.

ironic.api.controllers.v1.node.indicator_list_from_dict(node_ident, indicators)[source]
ironic.api.controllers.v1.node.network_data_schema()[source]
ironic.api.controllers.v1.node.node_patch_schema()[source]
ironic.api.controllers.v1.node.node_patch_validator(name, value)[source]
ironic.api.controllers.v1.node.node_sanitize(node, fields, cdict=None, show_driver_secrets=None, show_instance_secrets=None, evaluate_additional_policies=None)[source]

Removes sensitive and unrequested data.

Will only keep the fields specified in the fields parameter.

Parameters:
  • fields (list of str) – list of fields to preserve, or None to preserve them all

  • cdict – Context dictionary for policy values evaluation. If not provided, it will be executed by the method, however for enumerating node lists, it is more efficient to provide.

  • show_driver_secrets – A boolean value to allow external single evaluation of policy instead of once per node. Default None.

  • show_instance_secrets – A boolean value to allow external evaluation of policy instead of once per node. Default None.

  • evaluate_additional_policies – A boolean value to allow external evaluation of policy instead of once per node. Default None.

ironic.api.controllers.v1.node.node_schema()[source]
ironic.api.controllers.v1.node.node_states_convert(rpc_node)[source]
ironic.api.controllers.v1.node.node_validator(name, value)[source]
ironic.api.controllers.v1.node.reject_fields_in_newer_versions(obj)[source]

When creating an object, reject fields that appear in newer versions.

ironic.api.controllers.v1.node.reject_patch_in_newer_versions(patch)[source]
ironic.api.controllers.v1.node.update_state_in_older_versions(obj)[source]

Change provision state names for API backwards compatibility.

Parameters:

obj – The dict being returned to the API client that is to be updated by this method.

ironic.api.controllers.v1.node.validate_network_data(network_data)[source]

Validates node network_data field.

This method validates network data configuration against JSON schema.

Parameters:

network_data – a network_data field to validate

Raises:

Invalid if network data is not schema-compliant