ironicclient.v1.node module

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

Bases: ironicclient.common.base.Resource

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

Bases: ironicclient.common.base.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_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, 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.

Returns

A list of nodes.

list_bios_settings(node_ident, 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.

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_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)[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 – A gzipped, base64-encoded configuration drive string OR the path to the configuration drive file OR the path to a directory containing the config drive files OR a dictionary to build config drive from. In case it’s a directory, a config drive will be generated from it. In case it’s a dictionary, 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.

Raises

InvalidAttribute if there was an error with the clean steps

Returns

The status of the request

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 a node 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

  • 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