ironicclient.v1.node module

class ironicclient.v1.node.Node(manager, info, loaded=False)[source]

Bases: Resource

class ironicclient.v1.node.NodeManager(api)[source]

Bases: CreateManager

add_trait(node_ident, trait, os_ironic_api_version=None, global_request_id=None)[source]

Add a trait to a node.

Parameters:
  • node_ident – node UUID or name.

  • trait – trait to add to the node.

  • os_ironic_api_version – String version (e.g. “1.35”) to use for the request. If not specified, the client’s default is used.

  • global_request_id – String containing global request ID header value (in form “req-<UUID>”) to use for the request.

delete(node_id, os_ironic_api_version=None, global_request_id=None)[source]
get(node_id, fields=None, os_ironic_api_version=None, global_request_id=None)[source]
get_bios_setting(node_ident, name, os_ironic_api_version=None, global_request_id=None)[source]

Get a BIOS setting from a node.

Parameters:
  • node_ident – node UUID or name.

  • name – BIOS setting name to get from the node.

  • os_ironic_api_version – String version (e.g. “1.35”) to use for the request. If not specified, the client’s default is used.

  • global_request_id – String containing global request ID header value (in form “req-<UUID>”) to use for the request.

get_boot_device(node_uuid, os_ironic_api_version=None, global_request_id=None)[source]
get_by_instance_uuid(instance_uuid, fields=None, os_ironic_api_version=None, global_request_id=None)[source]
get_console(node_uuid, os_ironic_api_version=None, global_request_id=None)[source]
get_history_event(node_ident, event, os_ironic_api_version=None, global_request_id=None)[source]

Get a single event record for a node.

Provides the ability to request, and return a node’s single event history entry.

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

  • event – The UUID of the event entry as listed in the node event history list.

  • os_ironic_api_version – String version (e.g. “1.35”) to use for the request. If not specified, the client’s default is used.

  • global_request_id – String containing global request ID header value (in form “req-<UUID>”) to use for the request.

get_history_list(node_ident, detail=False, os_ironic_api_version=None, global_request_id=None)[source]

Get node history event list.

Provides the ability to query a node event history list from the API and return the API response to the caller.

Requires API version 1.78.

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

  • detail – If detailed data should be returned in the event list entry. Default False.

  • os_ironic_api_version – String version (e.g. “1.35”) to use for the request. If not specified, the client’s default is used.

  • global_request_id – String containing global request ID header value (in form “req-<UUID>”) to use for the request.

get_inventory(node_ident, os_ironic_api_version=None, global_request_id=None)[source]

Get the hardware inventory of the node.

Requires API version 1.81.

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

  • os_ironic_api_version – String version (e.g. “1.81”) to use for the request. If not specified, the client’s default is used.

  • global_request_id – String containing global request ID header value (in form “req-<UUID>”) to use for the request.

get_supported_boot_devices(node_uuid, os_ironic_api_version=None, global_request_id=None)[source]
get_traits(node_ident, os_ironic_api_version=None, global_request_id=None)[source]

Get traits for a node.

Parameters:
  • node_ident – node UUID or name.

  • os_ironic_api_version – String version (e.g. “1.35”) to use for the request. If not specified, the client’s default is used.

  • global_request_id – String containing global request ID header value (in form “req-<UUID>”) to use for the request.

get_vendor_passthru_methods(node_ident, os_ironic_api_version=None, global_request_id=None)[source]
inject_nmi(node_uuid, os_ironic_api_version=None, global_request_id=None)[source]
list(associated=None, maintenance=None, marker=None, limit=None, detail=False, sort_key=None, sort_dir=None, fields=None, provision_state=None, driver=None, resource_class=None, chassis=None, fault=None, os_ironic_api_version=None, conductor_group=None, conductor=None, owner=None, retired=None, lessee=None, shards=None, sharded=None, parent_node=None, include_children=None, global_request_id=None)[source]

Retrieve a list of nodes.

Parameters:
  • associated – Optional. Either a Boolean or a string representation of a Boolean that indicates whether to return a list of associated (True or “True”) or unassociated (False or “False”) nodes.

  • maintenance – Optional. Either a Boolean or a string representation of a Boolean that indicates whether to return nodes in maintenance mode (True or “True”), or not in maintenance mode (False or “False”).

  • retired – Optional. Either a Boolean or a string representation of a Boolean that indicates whether to return retired nodes (True or “True”).

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

  • marker – Optional, the UUID of a node, eg the last node from a previous result set. Return the next result set.

  • limit

    The maximum number of results to return per

    request, if:

    1. limit > 0, the maximum number of nodes to return.

    2. limit == 0, return the entire list of nodes.

    3. limit param is NOT specified (None), the number of items returned respect the maximum imposed by the Ironic API (see Ironic’s api.max_limit option).

  • detail – Optional, boolean whether to return detailed information about nodes.

  • sort_key – Optional, field used for sorting.

  • sort_dir – Optional, direction of sorting, either ‘asc’ (the default) or ‘desc’.

  • fields – Optional, a list with a specified set of fields of the resource to be returned. Can not be used when ‘detail’ is set.

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

  • resource_class – Optional. String value to get only nodes with the given resource class set.

  • chassis – Optional, the UUID of a chassis. Used to get only nodes of this chassis.

  • fault – Optional. String value to get only nodes with specified fault.

  • os_ironic_api_version – String version (e.g. “1.35”) to use for the request. If not specified, the client’s default is used.

  • global_request_id – String containing global request ID header value (in form “req-<UUID>”) to use for the request.

  • conductor_group – Optional. String value to get only nodes with the given conductor group set.

  • conductor – Optional. String value to get only nodes mapped to the given conductor.

  • owner – Optional. String value to get only nodes mapped to a specific owner.

  • lessee – Optional. String value to get only nodes mapped to a specific lessee.

  • shards – Optional. A list with a specified set of shards to limit node returns to.

  • sharded – Optional. Boolean value, when true get only nodes with a non-null node.shard value, when false get only nodes with a null node.shard value. None is a noop. with a non-null node.shard value.

  • parent_node – Optional. String value used to retrieve child nodes with the supplied parent node.

  • include_children – Optional. Boolean Value, only True is valid. Tells the ironic API to enumerate all child nodes which are normally hidden from the node list.

Returns:

A list of nodes.

list_bios_settings(node_ident, detail=False, fields=None, os_ironic_api_version=None, global_request_id=None)[source]

List all BIOS settings from a node.

Parameters:
  • node_ident – node UUID or name.

  • os_ironic_api_version – String version (e.g. “1.35”) to use for the request. If not specified, the client’s default is used.

  • global_request_id – String containing global request ID header value (in form “req-<UUID>”) to use for the request.

  • detail – Optional, boolean whether to return detailed information about bios settings.

  • fields – Optional, a list with a specified set of fields of the resource to be returned. Can not be used when ‘detail’ is set.

list_children_of_node(node_id, os_ironic_api_version=None, global_request_id=None)[source]

Get a list of child nodes for the supplied node_id.

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

  • os_ironic_api_version – String version (e.g. “1.35”) to use for the request. If not specified, the client’s default is used.

  • global_request_id – String containing global request ID header value (in form “req-<UUID>”) to use for the request.

Returns:

A list of UUIDs representing child nodes for the supplied node_id..

list_firmware_components(node_ident, os_ironic_api_version=None, global_request_id=None)[source]

List all firmware components from a node.

Parameters:
  • node_ident – node UUID or name.

  • os_ironic_api_version – String version (e.g. “1.35”) to use for the request. If not specified, the client’s default is used.

  • global_request_id – String containing global request ID header value (in form “req-<UUID>”) to use for the request.

list_ports(node_id, marker=None, limit=None, sort_key=None, sort_dir=None, detail=False, fields=None, os_ironic_api_version=None, global_request_id=None)[source]

List all the ports for a given node.

Parameters:
  • node_id – Name or UUID of the node.

  • marker – Optional, the UUID of a port, eg the last port from a previous result set. Return the next result set.

  • limit

    The maximum number of results to return per

    request, if:

    1. limit > 0, the maximum number of ports to return.

    2. limit == 0, return the entire list of ports.

    3. limit param is NOT specified (None), the number of items returned respect the maximum imposed by the Ironic API (see Ironic’s api.max_limit option).

  • sort_key – Optional, field used for sorting.

  • sort_dir – Optional, direction of sorting, either ‘asc’ (the default) or ‘desc’.

  • detail – Optional, boolean whether to return detailed information about ports.

  • fields – Optional, a list with a specified set of fields of the resource to be returned. Can not be used when ‘detail’ is set.

  • os_ironic_api_version – String version (e.g. “1.35”) to use for the request. If not specified, the client’s default is used.

  • global_request_id – String containing global request ID header value (in form “req-<UUID>”) to use for the request.

Returns:

A list of ports.

list_volume_connectors(node_id, marker=None, limit=None, sort_key=None, sort_dir=None, detail=False, fields=None, os_ironic_api_version=None, global_request_id=None)[source]

List all the volume connectors for a given node.

Parameters:
  • node_id – Name or UUID of the node.

  • marker – Optional, the UUID of a volume connector, eg the last volume connector from a previous result set. Return the next result set.

  • limit

    The maximum number of results to return per

    request, if:

    1. limit > 0, the maximum number of volume connectors to return.

    2. limit == 0, return the entire list of volume connectors.

    3. limit param is NOT specified (None), the number of items returned respect the maximum imposed by the Ironic API (see Ironic’s api.max_limit option).

  • sort_key – Optional, field used for sorting.

  • sort_dir – Optional, direction of sorting, either ‘asc’ (the default) or ‘desc’.

  • detail – Optional, boolean whether to return detailed information about volume connectors.

  • fields – Optional, a list with a specified set of fields of the resource to be returned. Can not be used when ‘detail’ is set.

  • os_ironic_api_version – String version (e.g. “1.35”) to use for the request. If not specified, the client’s default is used.

  • global_request_id – String containing global request ID header value (in form “req-<UUID>”) to use for the request.

Returns:

A list of volume connectors.

list_volume_targets(node_id, marker=None, limit=None, sort_key=None, sort_dir=None, detail=False, fields=None, os_ironic_api_version=None, global_request_id=None)[source]

List all the volume targets for a given node.

Parameters:
  • node_id – Name or UUID of the node.

  • marker – Optional, the UUID of a volume target, eg the last volume target from a previous result set. Return the next result set.

  • limit

    The maximum number of results to return per

    request, if:

    1. limit > 0, the maximum number of volume targets to return.

    2. limit == 0, return the entire list of volume targets.

    3. limit param is NOT specified (None), the number of items returned respect the maximum imposed by the Ironic API (see Ironic’s api.max_limit option).

  • sort_key – Optional, field used for sorting.

  • sort_dir – Optional, direction of sorting, either ‘asc’ (the default) or ‘desc’.

  • detail – Optional, boolean whether to return detailed information about volume targets.

  • fields – Optional, a list with a specified set of fields of the resource to be returned. Can not be used when ‘detail’ is set.

  • os_ironic_api_version – String version (e.g. “1.35”) to use for the request. If not specified, the client’s default is used.

  • global_request_id – String containing global request ID header value (in form “req-<UUID>”) to use for the request.

Returns:

A list of volume targets.

remove_all_traits(node_ident, os_ironic_api_version=None, global_request_id=None)[source]

Remove all traits from a node.

Parameters:
  • node_ident – node UUID or name.

  • os_ironic_api_version – String version (e.g. “1.35”) to use for the request. If not specified, the client’s default is used.

  • global_request_id – String containing global request ID header value (in form “req-<UUID>”) to use for the request.

remove_trait(node_ident, trait, os_ironic_api_version=None, global_request_id=None)[source]

Remove a trait from a node.

Parameters:
  • node_ident – node UUID or name.

  • trait – trait to remove from the node.

  • os_ironic_api_version – String version (e.g. “1.35”) to use for the request. If not specified, the client’s default is used.

  • global_request_id – String containing global request ID header value (in form “req-<UUID>”) to use for the request.

resource_class

alias of Node

set_boot_device(node_uuid, boot_device, persistent=False, os_ironic_api_version=None, global_request_id=None)[source]
set_boot_mode(node_id, state, os_ironic_api_version=None, global_request_id=None)[source]

Sets boot mode for a node.

Parameters:
  • node_id – Node identifier

  • state – One of target boot modes, ‘uefi’ or ‘bios’

  • os_ironic_api_version – String version (e.g. “1.76”) to use for the request. If not specified, the client’s default is used.

  • global_request_id – String containing global request ID header value (in form “req-<UUID>”) to use for the request.

Raises:

ValueError if boot mode is not one of ‘uefi’ / ‘bios’

Returns:

The status of the request

set_console_mode(node_uuid, enabled, os_ironic_api_version=None, global_request_id=None)[source]

Set the console mode for the node.

Parameters:
  • node_uuid – The UUID of the node.

  • enabled – Either a Boolean or a string representation of a Boolean. True to enable the console; False to disable.

  • os_ironic_api_version – String version (e.g. “1.35”) to use for the request. If not specified, the client’s default is used.

  • global_request_id – String containing global request ID header value (in form “req-<UUID>”) to use for the request.

set_maintenance(node_id, state, maint_reason=None, os_ironic_api_version=None, global_request_id=None)[source]

Set the maintenance mode for the node.

Parameters:
  • node_id – The UUID of the node.

  • state – the maintenance mode; either a Boolean or a string representation of a Boolean (eg, ‘true’, ‘on’, ‘false’, ‘off’). True to put the node in maintenance mode; False to take the node out of maintenance mode.

  • maint_reason – Optional string. Reason for putting node into maintenance mode.

  • os_ironic_api_version – String version (e.g. “1.35”) to use for the request. If not specified, the client’s default is used.

  • global_request_id – String containing global request ID header value (in form “req-<UUID>”) to use for the request.

Raises:

InvalidAttribute if state is an invalid string (that doesn’t represent a Boolean).

set_power_state(node_id, state, soft=False, timeout=None, os_ironic_api_version=None, global_request_id=None)[source]

Sets power state for a node.

Parameters:
  • node_id – Node identifier

  • state – One of target power state, ‘on’, ‘off’, or ‘reboot’

  • soft – The flag for graceful power ‘off’ or ‘reboot’

  • timeout – The timeout (in seconds) positive integer value (> 0)

  • os_ironic_api_version – String version (e.g. “1.35”) to use for the request. If not specified, the client’s default is used.

  • global_request_id – String containing global request ID header value (in form “req-<UUID>”) to use for the request.

Raises:

ValueError if ‘soft’ or ‘timeout’ option is invalid

Returns:

The status of the request

set_provision_state(node_uuid, state, configdrive=None, cleansteps=None, rescue_password=None, os_ironic_api_version=None, global_request_id=None, deploysteps=None)[source]

Set the provision state for the node.

Parameters:
  • node_uuid – The UUID or name of the node.

  • state – The desired provision state. One of ‘active’, ‘deleted’, ‘rebuild’, ‘inspect’, ‘provide’, ‘manage’, ‘clean’, ‘abort’, ‘rescue’, ‘unrescue’.

  • configdrive

    One of:

    • a gzipped, base64-encoded configuration drive string

    • a dictionary to build config drive from

    • a path to the configuration drive file (ISO 9660 or VFAT)

    • a path to a directory containing the config drive files

    • a path to a JSON file to build config from

    In case it’s a directory, a config drive will be generated from it. In case it’s a dictionary or a JSON file, a config drive will be generated on the server side (requires API version 1.56). This is only valid when setting state to ‘active’.

  • cleansteps – The clean steps as a list of clean-step dictionaries; each dictionary should have keys ‘interface’ and ‘step’, and optional key ‘args’. This must be specified (and is only valid) when setting provision-state to ‘clean’.

  • rescue_password – A string to be used as the login password inside the rescue ramdisk once a node is rescued. This must be specified (and is only valid) when setting ‘state’ to ‘rescue’.

  • os_ironic_api_version – String version (e.g. “1.35”) to use for the request. If not specified, the client’s default is used.

  • global_request_id – String containing global request ID header value (in form “req-<UUID>”) to use for the request.

  • deploysteps – The deploy steps as a list of deploy-step dictionaries; each dictionary should have keys ‘interface’, ‘step’, ‘priority’, and optional key ‘args’. This is optional and is only valid when setting provision-state to ‘active’ or ‘rebuild’.

Raises:

InvalidAttribute if there was an error with the clean steps or deploy steps

Returns:

The status of the request

set_secure_boot(node_id, state, os_ironic_api_version=None, global_request_id=None)[source]

Set the secure boot state for the node.

Parameters:
  • node_id – The UUID of the node.

  • state – the secure boot state; either a Boolean or a string representation of a Boolean (eg, ‘true’, ‘on’, ‘false’, ‘off’). True to turn secure boot on; False to turn secure boot off.

  • os_ironic_api_version – String version (e.g. “1.76”) to use for the request. If not specified, the client’s default is used.

  • global_request_id – String containing global request ID header value (in form “req-<UUID>”) to use for the request.

Raises:

InvalidAttribute if state is an invalid string (that doesn’t represent a Boolean).

set_target_raid_config(node_ident, target_raid_config, os_ironic_api_version=None, global_request_id=None)[source]

Sets target_raid_config for a node.

Parameters:
  • node_ident – Node identifier

  • target_raid_config – A dictionary with the target RAID configuration; may be empty.

  • os_ironic_api_version – String version (e.g. “1.35”) to use for the request. If not specified, the client’s default is used.

  • global_request_id – String containing global request ID header value (in form “req-<UUID>”) to use for the request.

Returns:

status of the request

set_traits(node_ident, traits, os_ironic_api_version=None, global_request_id=None)[source]

Set traits for a node.

Removes any existing traits and adds the traits passed in to this method.

Parameters:
  • node_ident – node UUID or name.

  • traits – list of traits to add to the node.

  • os_ironic_api_version – String version (e.g. “1.35”) to use for the request. If not specified, the client’s default is used.

  • global_request_id – String containing global request ID header value (in form “req-<UUID>”) to use for the request.

states(node_uuid, os_ironic_api_version=None, global_request_id=None)[source]
update(node_id, patch, http_method='PATCH', os_ironic_api_version=None, reset_interfaces=None, global_request_id=None)[source]
validate(node_uuid, os_ironic_api_version=None, global_request_id=None)[source]
vendor_passthru(node_id, method, args=None, http_method=None, os_ironic_api_version=None, global_request_id=None)[source]

Issue requests for vendor-specific actions on a given node.

Parameters:
  • node_id – The UUID of the node.

  • method – Name of the vendor method.

  • args – Optional. The arguments to be passed to the method.

  • http_method – The HTTP method to use on the request. Defaults to POST.

  • os_ironic_api_version – String version (e.g. “1.35”) to use for the request. If not specified, the client’s default is used.

  • global_request_id – String containing global request ID header value (in form “req-<UUID>”) to use for the request.

vif_attach(node_ident, vif_id, os_ironic_api_version=None, global_request_id=None, **kwargs)[source]

Attach VIF to a given node.

Parameters:
  • node_ident – The UUID or Name of the node.

  • vif_id – The UUID or Name of the VIF to attach.

  • os_ironic_api_version – String version (e.g. “1.35”) to use for the request. If not specified, the client’s default is used.

  • global_request_id – String containing global request ID header value (in form “req-<UUID>”) to use for the request.

  • kwargs – A dictionary containing the attributes of the resource that will be created.

vif_detach(node_ident, vif_id, os_ironic_api_version=None, global_request_id=None)[source]

Detach VIF from a given node.

Parameters:
  • node_ident – The UUID or Name of the node.

  • vif_id – The UUID or Name of the VIF to detach.

  • os_ironic_api_version – String version (e.g. “1.35”) to use for the request. If not specified, the client’s default is used.

  • global_request_id – String containing global request ID header value (in form “req-<UUID>”) to use for the request.

vif_list(node_ident, os_ironic_api_version=None, global_request_id=None)[source]

List VIFs attached to a given node.

Parameters:
  • node_ident – The UUID or Name of the node.

  • os_ironic_api_version – String version (e.g. “1.35”) to use for the request. If not specified, the client’s default is used.

  • global_request_id – String containing global request ID header value (in form “req-<UUID>”) to use for the request.

wait_for_provision_state(node_ident, expected_state, timeout=0, poll_interval=2, poll_delay_function=None, fail_on_unexpected_state=True, os_ironic_api_version=None, global_request_id=None)[source]

Helper function to wait for nodes to reach a given state.

Polls Ironic API in a loop until node gets to a requested state.

Fails in the following cases: * Timeout (if provided) is reached * Node’s last_error gets set to a non-empty value * Unexpected stable state is reached and fail_on_unexpected_state is on * Error state is reached (if it’s not equal to expected_state)

Parameters:
  • node_ident – node UUID or name (one or a list)

  • expected_state – expected final provision state

  • timeout – timeout in seconds, no timeout if 0

  • poll_interval – interval in seconds between 2 poll

  • poll_delay_function – function to use to wait between polls (defaults to time.sleep). Should take one argument - delay time in seconds. Any exceptions raised inside it will abort the wait.

  • fail_on_unexpected_state – whether to fail if the nodes reaches a different stable state.

  • os_ironic_api_version – String version (e.g. “1.35”) to use for the request. If not specified, the client’s default is used.

  • global_request_id – String containing global request ID header value (in form “req-<UUID>”) to use for the request.

Raises:

StateTransitionFailed if node reached an error state

Raises:

StateTransitionTimeout on timeout