ironicclient.v1.node module

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)[source]

Add a trait to a node.

Parameters:
  • node_ident – node UUID or name.
  • trait – trait to add to the node.
delete(node_id)[source]
get(node_id, fields=None, os_ironic_api_version=None)[source]
get_bios_setting(node_ident, name)[source]

Get a BIOS setting from a node.

Parameters:
  • node_ident – node UUID or name.
  • name – BIOS setting name to get from the node.
get_boot_device(node_uuid)[source]
get_by_instance_uuid(instance_uuid, fields=None)[source]
get_console(node_uuid)[source]
get_supported_boot_devices(node_uuid)[source]
get_traits(node_ident)[source]

Get traits for a node.

Parameters:node_ident – node UUID or name.
get_vendor_passthru_methods(node_ident)[source]
inject_nmi(node_uuid)[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)[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”).
  • 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.
  • 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.
Returns:

A list of nodes.

list_bios_settings(node_ident)[source]

List all BIOS settings from a node.

Parameters:node_ident – node UUID or name.
list_ports(node_id, marker=None, limit=None, sort_key=None, sort_dir=None, detail=False, fields=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.
Returns:

A list of ports.

list_volume_connectors(node_id, marker=None, limit=None, sort_key=None, sort_dir=None, detail=False, fields=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.
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)[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.
Returns:

A list of volume targets.

remove_all_traits(node_ident)[source]

Remove all traits from a node.

Parameters:node_ident – node UUID or name.
remove_trait(node_ident, trait)[source]

Remove a trait from a node.

Parameters:
  • node_ident – node UUID or name.
  • trait – trait to remove from the node.
resource_class

alias of Node

set_boot_device(node_uuid, boot_device, persistent=False)[source]
set_console_mode(node_uuid, enabled)[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.
set_maintenance(node_id, state, maint_reason=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.
Raises:

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

set_power_state(node_id, state, soft=False, timeout=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)
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)[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.
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)[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.
Returns:

status of the request

set_traits(node_ident, traits)[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.
states(node_uuid)[source]
update(node_id, patch, http_method='PATCH', os_ironic_api_version=None, reset_interfaces=None)[source]
validate(node_uuid)[source]
vendor_passthru(node_id, method, args=None, http_method=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.
vif_attach(node_ident, vif_id, **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.
  • kwargs – A dictionary containing the attributes of the resource that will be created.
vif_detach(node_ident, vif_id)[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.
vif_list(node_ident)[source]

List VIFs attached to a given node.

Parameters:node_ident – The UUID or Name of the node.
wait_for_provision_state(node_ident, expected_state, timeout=0, poll_interval=2, poll_delay_function=None, fail_on_unexpected_state=True)[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.
Raises:

StateTransitionFailed if node reached an error state

Raises:

StateTransitionTimeout on timeout

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.