Baremetal API

For details on how to use baremetal, see Using OpenStack Baremetal

The Baremetal Class

The baremetal high-level interface is available through the baremetal member of a Connection object. The baremetal member will only be added if the service is detected.

Node Operations

class openstack.baremetal.v1._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
nodes(details=False, **query)

Retrieve a generator of nodes.

Parameters
  • details – A boolean indicating whether the detailed information for every node should be returned.

  • query (dict) –

    Optional query parameters to be sent to restrict the nodes returned. Available parameters include:

    • associated: Only return those which are, or are not, associated with an instance_id.

    • conductor_group: Only return those in the specified conductor_group.

    • driver: Only return those with the specified driver.

    • fault: Only return those with the specified fault type.

    • fields: A list containing one or more fields to be returned in the response. This may lead to some performance gain because other fields of the resource are not refreshed.

    • instance_id: Only return the node with this specific instance UUID or an empty set if not found.

    • is_maintenance: Only return those with maintenance set to True or False.

    • limit: Requests at most the specified number of nodes be returned from the query.

    • marker: Specifies the ID of the last-seen node. Use the limit parameter to make an initial limited request and use the ID of the last-seen node from the response as the marker value in a subsequent limited request.

    • provision_state: Only return those nodes with the specified provision_state.

    • resource_class: Only return those with the specified resource_class.

    • sort_dir: Sorts the response by the requested sort direction. A valid value is asc (ascending) or desc (descending). Default is asc. You can specify multiple pairs of sort key and sort direction query parameters. If you omit the sort direction in a pair, the API uses the natural sorting direction of the server attribute that is provided as the sort_key.

    • sort_key: Sorts the response by the this attribute value. Default is id. You can specify multiple pairs of sort key and sort direction query pa rameters. If you omit the sort direction in a pair, the API uses the natural sorting direction of the server attribute that is provided as the sort_key.

Returns

A generator of Node

create_node(**attrs)

Create a new node from attributes.

Parameters

attrs (dict) – Keyword arguments that will be used to create a Node.

Returns

The results of node creation.

Return type

Node.

find_node(name_or_id, ignore_missing=True)

Find a single node.

Parameters
  • name_or_id (str) – The name or ID of a node.

  • ignore_missing (bool) – When set to False, an exception of ResourceNotFound will be raised when the node does not exist. When set to True`, None will be returned when attempting to find a nonexistent node.

Returns

One Node object or None.

get_node(node, fields=None)

Get a specific node.

Parameters
  • node – The value can be the name or ID of a node or a Node instance.

  • fields – Limit the resource fields to fetch.

Returns

One Node

Raises

ResourceNotFound when no node matching the name or ID could be found.

update_node(node, retry_on_conflict=True, **attrs)

Update a node.

Parameters
  • node – The value can be the name or ID of a node or a Node instance.

  • retry_on_conflict (bool) – Whether to retry HTTP CONFLICT error. Most of the time it can be retried, since it is caused by the node being locked. However, when setting instance_id, this is a normal code and should not be retried.

  • attrs (dict) – The attributes to update on the node represented by the node parameter.

Returns

The updated node.

Return type

Node

patch_node(node, patch, reset_interfaces=None, retry_on_conflict=True)

Apply a JSON patch to the node.

Parameters
  • node – The value can be the name or ID of a node or a Node instance.

  • patch – JSON patch to apply.

  • reset_interfaces (bool) – whether to reset the node hardware interfaces to their defaults. This works only when changing drivers. Added in API microversion 1.45.

  • retry_on_conflict (bool) –

    Whether to retry HTTP CONFLICT error. Most of the time it can be retried, since it is caused by the node being locked. However, when setting instance_id, this is a normal code and should not be retried.

    See Update Node for details.

Returns

The updated node.

Return type

Node

set_node_provision_state(node, target, config_drive=None, clean_steps=None, rescue_password=None, wait=False, timeout=None, deploy_steps=None)

Run an action modifying node’s provision state.

This call is asynchronous, it will return success as soon as the Bare Metal service acknowledges the request.

Parameters
  • node – The value can be the name or ID of a node or a Node instance.

  • target – Provisioning action, e.g. active, provide. See the Bare Metal service documentation for available actions.

  • config_drive – Config drive to pass to the node, only valid for active` and ``rebuild targets. You can use functions from openstack.baremetal.configdrive to build it.

  • clean_steps – Clean steps to execute, only valid for clean target.

  • rescue_password – Password for the rescue operation, only valid for rescue target.

  • wait – Whether to wait for the node to get into the expected state. The expected state is determined from a combination of the current provision state and target.

  • timeout – If wait is set to True, specifies how much (in seconds) to wait for the expected state to be reached. The value of None (the default) means no client-side timeout.

  • deploy_steps – Deploy steps to execute, only valid for active and rebuild target.

Returns

The updated Node

Raises

ValueError if config_drive, clean_steps, deploy_steps or rescue_password are provided with an invalid target.

wait_for_nodes_provision_state(nodes, expected_state, timeout=None, abort_on_failed_state=True, fail=True)

Wait for the nodes to reach the expected state.

Parameters
  • nodes – List of nodes - name, ID or Node instance.

  • expected_state – The expected provisioning state to reach.

  • timeout – If wait is set to True, specifies how much (in seconds) to wait for the expected state to be reached. The value of None (the default) means no client-side timeout.

  • abort_on_failed_state – If True (the default), abort waiting if any node reaches a failure state which does not match the expected one. Note that the failure state for enroll -> manageable transition is enroll again.

  • fail – If set to False this call will not raise on timeouts and provisioning failures.

Returns

If fail is True (the default), the list of Node instances that reached the requested state. If fail is False, a WaitResult named tuple.

Raises

ResourceFailure if a node reaches an error state and abort_on_failed_state is True.

Raises

ResourceTimeout on timeout.

set_node_power_state(node, target, wait=False, timeout=None)

Run an action modifying node’s power state.

This call is asynchronous, it will return success as soon as the Bare Metal service acknowledges the request.

Parameters
  • node – The value can be the name or ID of a node or a Node instance.

  • target – Target power state, one of PowerAction or a string.

  • wait – Whether to wait for the node to get into the expected state.

  • timeout – If wait is set to True, specifies how much (in seconds) to wait for the expected state to be reached. The value of None (the default) means no client-side timeout.

wait_for_node_power_state(node, expected_state, timeout=None)

Wait for the node to reach the power state.

Parameters
  • node – The value can be the name or ID of a node or a Node instance.

  • timeout – How much (in seconds) to wait for the target state to be reached. The value of None (the default) means no timeout.

Returns

The updated Node

wait_for_node_reservation(node, timeout=None)

Wait for a lock on the node to be released.

Bare metal nodes in ironic have a reservation lock that is used to represent that a conductor has locked the node while performing some sort of action, such as changing configuration as a result of a machine state change.

This lock can occur during power syncronization, and prevents updates to objects attached to the node, such as ports.

Note that nothing prevents a conductor from acquiring the lock again after this call returns, so it should be treated as best effort.

Returns immediately if there is no reservation on the node.

Parameters
  • node – The value can be the name or ID of a node or a Node instance.

  • timeout – How much (in seconds) to wait for the lock to be released. The value of None (the default) means no timeout.

Returns

The updated Node

validate_node(node, required=('boot', 'deploy', 'power'))

Validate required information on a node.

Parameters
  • node – The value can be either the name or ID of a node or a Node instance.

  • required – List of interfaces that are required to pass validation. The default value is the list of minimum required interfaces for provisioning.

Returns

dict mapping interface names to ValidationResult objects.

Raises

ValidationException if validation fails for a required interface.

set_node_maintenance(node, reason=None)

Enable maintenance mode on the node.

Parameters
  • node – The value can be either the name or ID of a node or a Node instance.

  • reason – Optional reason for maintenance.

Returns

This Node instance.

unset_node_maintenance(node)

Disable maintenance mode on the node.

Parameters

node – The value can be either the name or ID of a node or a Node instance.

Returns

This Node instance.

delete_node(node, ignore_missing=True)

Delete a node.

Parameters
  • node – The value can be either the name or ID of a node or a Node instance.

  • ignore_missing (bool) – When set to False, an exception ResourceNotFound will be raised when the node could not be found. When set to True, no exception will be raised when attempting to delete a non-existent node.

Returns

The instance of the node which was deleted.

Return type

Node.

Port Operations

class openstack.baremetal.v1._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
ports(details=False, **query)

Retrieve a generator of ports.

Parameters
  • details – A boolean indicating whether the detailed information for every port should be returned.

  • query (dict) –

    Optional query parameters to be sent to restrict the ports returned. Available parameters include:

    • address: Only return ports with the specified physical hardware address, typically a MAC address.

    • driver: Only return those with the specified driver.

    • fields: A list containing one or more fields to be returned in the response. This may lead to some performance gain because other fields of the resource are not refreshed.

    • limit: Requests at most the specified number of ports be returned from the query.

    • marker: Specifies the ID of the last-seen port. Use the limit parameter to make an initial limited request and use the ID of the last-seen port from the response as the marker value in a subsequent limited request.

    • node:only return the ones associated with this specific node (name or UUID), or an empty set if not found.

    • node_id:only return the ones associated with this specific node UUID, or an empty set if not found.

    • portgroup: only return the ports associated with this specific Portgroup (name or UUID), or an empty set if not found. Added in API microversion 1.24.

    • sort_dir: Sorts the response by the requested sort direction. A valid value is asc (ascending) or desc (descending). Default is asc. You can specify multiple pairs of sort key and sort direction query parameters. If you omit the sort direction in a pair, the API uses the natural sorting direction of the server attribute that is provided as the sort_key.

    • sort_key: Sorts the response by the this attribute value. Default is id. You can specify multiple pairs of sort key and sort direction query parameters. If you omit the sort direction in a pair, the API uses the natural sorting direction of the server attribute that is provided as the sort_key.

Returns

A generator of port instances.

create_port(**attrs)

Create a new port from attributes.

Parameters

attrs (dict) – Keyword arguments that will be used to create a Port.

Returns

The results of port creation.

Return type

Port.

find_port(name_or_id, ignore_missing=True)

Find a single port.

Parameters
  • name_or_id (str) – The ID of a port.

  • ignore_missing (bool) – When set to False, an exception of ResourceNotFound will be raised when the port does not exist. When set to True`, None will be returned when attempting to find a nonexistent port.

Returns

One Port object or None.

get_port(port, fields=None)

Get a specific port.

Parameters
  • port – The value can be the ID of a port or a Port instance.

  • fields – Limit the resource fields to fetch.

Returns

One Port

Raises

ResourceNotFound when no port matching the name or ID could be found.

update_port(port, **attrs)

Update a port.

Parameters
  • port – Either the ID of a port or an instance of Port.

  • attrs (dict) – The attributes to update on the port represented by the port parameter.

Returns

The updated port.

Return type

Port

patch_port(port, patch)

Apply a JSON patch to the port.

Parameters
  • port – The value can be the ID of a port or a Port instance.

  • patch – JSON patch to apply.

Returns

The updated port.

Return type

Port

delete_port(port, ignore_missing=True)

Delete a port.

Parameters
  • port – The value can be either the ID of a port or a Port instance.

  • ignore_missing (bool) – When set to False, an exception ResourceNotFound will be raised when the port could not be found. When set to True, no exception will be raised when attempting to delete a non-existent port.

Returns

The instance of the port which was deleted.

Return type

Port.

Port Group Operations

class openstack.baremetal.v1._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
port_groups(details=False, **query)

Retrieve a generator of port groups.

Parameters
  • details – A boolean indicating whether the detailed information for every port group should be returned.

  • query (dict) –

    Optional query parameters to be sent to restrict the port groups returned. Available parameters include:

    • address: Only return portgroups with the specified physical hardware address, typically a MAC address.

    • fields: A list containing one or more fields to be returned in the response. This may lead to some performance gain because other fields of the resource are not refreshed.

    • limit: Requests at most the specified number of portgroups returned from the query.

    • marker: Specifies the ID of the last-seen portgroup. Use the limit parameter to make an initial limited request and use the ID of the last-seen portgroup from the response as the marker value in a subsequent limited request.

    • node:only return the ones associated with this specific node (name or UUID), or an empty set if not found.

    • sort_dir: Sorts the response by the requested sort direction. A valid value is asc (ascending) or desc (descending). Default is asc. You can specify multiple pairs of sort key and sort direction query parameters. If you omit the sort direction in a pair, the API uses the natural sorting direction of the server attribute that is provided as the sort_key.

    • sort_key: Sorts the response by the this attribute value. Default is id. You can specify multiple pairs of sort key and sort direction query parameters. If you omit the sort direction in a pair, the API uses the natural sorting direction of the server attribute that is provided as the sort_key.

Returns

A generator of port group instances.

create_port_group(**attrs)

Create a new portgroup from attributes.

Parameters

attrs (dict) – Keyword arguments that will be used to create a PortGroup.

Returns

The results of portgroup creation.

Return type

PortGroup.

find_port_group(name_or_id, ignore_missing=True)

Find a single port group.

Parameters
  • name_or_id (str) – The name or ID of a portgroup.

  • ignore_missing (bool) – When set to False, an exception of ResourceNotFound will be raised when the port group does not exist. When set to True`, None will be returned when attempting to find a nonexistent port group.

Returns

One PortGroup object or None.

get_port_group(port_group, fields=None)

Get a specific port group.

Parameters
  • port_group – The value can be the name or ID of a chassis or a PortGroup instance.

  • fields – Limit the resource fields to fetch.

Returns

One PortGroup

Raises

ResourceNotFound when no port group matching the name or ID could be found.

update_port_group(port_group, **attrs)

Update a port group.

Parameters
  • port_group – Either the name or the ID of a port group or an instance of PortGroup.

  • attrs (dict) – The attributes to update on the port group represented by the port_group parameter.

Returns

The updated port group.

Return type

PortGroup

patch_port_group(port_group, patch)

Apply a JSON patch to the port_group.

Parameters
  • port_group – The value can be the ID of a port group or a PortGroup instance.

  • patch – JSON patch to apply.

Returns

The updated port group.

Return type

PortGroup

delete_port_group(port_group, ignore_missing=True)

Delete a port group.

Parameters
  • port_group – The value can be either the name or ID of a port group or a PortGroup instance.

  • ignore_missing (bool) – When set to False, an exception ResourceNotFound will be raised when the port group could not be found. When set to True, no exception will be raised when attempting to delete a non-existent port group.

Returns

The instance of the port group which was deleted.

Return type

PortGroup.

Driver Operations

class openstack.baremetal.v1._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
drivers(details=False, **query)

Retrieve a generator of drivers.

Parameters
  • details (bool) – A boolean indicating whether the detailed information for every driver should be returned.

  • query (kwargs) – Optional query parameters to be sent to limit the resources being returned.

Returns

A generator of driver instances.

get_driver(driver)

Get a specific driver.

Parameters

driver – The value can be the name of a driver or a Driver instance.

Returns

One Driver

Raises

ResourceNotFound when no driver matching the name could be found.

Chassis Operations

class openstack.baremetal.v1._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
chassis(details=False, **query)

Retrieve a generator of chassis.

Parameters
  • details – A boolean indicating whether the detailed information for every chassis should be returned.

  • query (dict) –

    Optional query parameters to be sent to restrict the chassis to be returned. Available parameters include:

    • fields: A list containing one or more fields to be returned in the response. This may lead to some performance gain because other fields of the resource are not refreshed.

    • limit: Requests at most the specified number of items be returned from the query.

    • marker: Specifies the ID of the last-seen chassis. Use the limit parameter to make an initial limited request and use the ID of the last-seen chassis from the response as the marker value in a subsequent limited request.

    • sort_dir: Sorts the response by the requested sort direction. A valid value is asc (ascending) or desc (descending). Default is asc. You can specify multiple pairs of sort key and sort direction query parameters. If you omit the sort direction in a pair, the API uses the natural sorting direction of the server attribute that is provided as the sort_key.

    • sort_key: Sorts the response by the this attribute value. Default is id. You can specify multiple pairs of sort key and sort direction query parameters. If you omit the sort direction in a pair, the API uses the natural sorting direction of the server attribute that is provided as the sort_key.

Returns

A generator of chassis instances.

create_chassis(**attrs)

Create a new chassis from attributes.

Parameters

attrs (dict) – Keyword arguments that will be used to create a Chassis.

Returns

The results of chassis creation.

Return type

Chassis.

find_chassis(name_or_id, ignore_missing=True)

Find a single chassis.

Parameters
  • name_or_id (str) – The ID of a chassis.

  • ignore_missing (bool) – When set to False, an exception of ResourceNotFound will be raised when the chassis does not exist. When set to True`, None will be returned when attempting to find a nonexistent chassis.

Returns

One Chassis object or None.

get_chassis(chassis, fields=None)

Get a specific chassis.

Parameters
  • chassis – The value can be the ID of a chassis or a Chassis instance.

  • fields – Limit the resource fields to fetch.

Returns

One Chassis

Raises

ResourceNotFound when no chassis matching the name or ID could be found.

update_chassis(chassis, **attrs)

Update a chassis.

Parameters
  • chassis – Either the ID of a chassis, or an instance of Chassis.

  • attrs (dict) – The attributes to update on the chassis represented by the chassis parameter.

Returns

The updated chassis.

Return type

Chassis

patch_chassis(chassis, patch)

Apply a JSON patch to the chassis.

Parameters
  • chassis – The value can be the ID of a chassis or a Chassis instance.

  • patch – JSON patch to apply.

Returns

The updated chassis.

Return type

Chassis

delete_chassis(chassis, ignore_missing=True)

Delete a chassis.

Parameters
  • chassis – The value can be either the ID of a chassis or a Chassis instance.

  • ignore_missing (bool) – When set to False, an exception ResourceNotFound will be raised when the chassis could not be found. When set to True, no exception will be raised when attempting to delete a non-existent chassis.

Returns

The instance of the chassis which was deleted.

Return type

Chassis.

VIF Operations

class openstack.baremetal.v1._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
attach_vif_to_node(node, vif_id, retry_on_conflict=True)

Attach a VIF to the node.

The exact form of the VIF ID depends on the network interface used by the node. In the most common case it is a Network service port (NOT a Bare Metal port) ID. A VIF can only be attached to one node at a time.

Parameters
  • node – The value can be either the name or ID of a node or a Node instance.

  • vif_id (string) – Backend-specific VIF ID.

  • retry_on_conflict – Whether to retry HTTP CONFLICT errors. This can happen when either the VIF is already used on a node or the node is locked. Since the latter happens more often, the default value is True.

Returns

None

Raises

NotSupported if the server does not support the VIF API.

detach_vif_from_node(node, vif_id, ignore_missing=True)

Detach a VIF from the node.

The exact form of the VIF ID depends on the network interface used by the node. In the most common case it is a Network service port (NOT a Bare Metal port) ID.

Parameters
  • node – The value can be either the name or ID of a node or a Node instance.

  • vif_id (string) – Backend-specific VIF ID.

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the VIF does not exist. Otherwise, False is returned.

Returns

True if the VIF was detached, otherwise False.

Raises

NotSupported if the server does not support the VIF API.

list_node_vifs(node)

List IDs of VIFs attached to the node.

The exact form of the VIF ID depends on the network interface used by the node. In the most common case it is a Network service port (NOT a Bare Metal port) ID.

Parameters

node – The value can be either the name or ID of a node or a Node instance.

Returns

List of VIF IDs as strings.

Raises

NotSupported if the server does not support the VIF API.

Allocation Operations

class openstack.baremetal.v1._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
allocations(**query)

Retrieve a generator of allocations.

Parameters

query (dict) –

Optional query parameters to be sent to restrict the allocation to be returned. Available parameters include:

  • fields: A list containing one or more fields to be returned in the response. This may lead to some performance gain because other fields of the resource are not refreshed.

  • limit: Requests at most the specified number of items be returned from the query.

  • marker: Specifies the ID of the last-seen allocation. Use the limit parameter to make an initial limited request and use the ID of the last-seen allocation from the response as the marker value in a subsequent limited request.

  • sort_dir: Sorts the response by the requested sort direction. A valid value is asc (ascending) or desc (descending). Default is asc. You can specify multiple pairs of sort key and sort direction query parameters. If you omit the sort direction in a pair, the API uses the natural sorting direction of the server attribute that is provided as the sort_key.

  • sort_key: Sorts the response by the this attribute value. Default is id. You can specify multiple pairs of sort key and sort direction query parameters. If you omit the sort direction in a pair, the API uses the natural sorting direction of the server attribute that is provided as the sort_key.

Returns

A generator of allocation instances.

create_allocation(**attrs)

Create a new allocation from attributes.

Parameters

attrs (dict) – Keyword arguments that will be used to create a Allocation.

Returns

The results of allocation creation.

Return type

Allocation.

get_allocation(allocation, fields=None)

Get a specific allocation.

Parameters
  • allocation – The value can be the name or ID of an allocation or a Allocation instance.

  • fields – Limit the resource fields to fetch.

Returns

One Allocation

Raises

ResourceNotFound when no allocation matching the name or ID could be found.

update_allocation(allocation, **attrs)

Update an allocation.

Parameters
  • allocation – The value can be the name or ID of an allocation or a Allocation instance.

  • attrs (dict) – The attributes to update on the allocation represented by the allocation parameter.

Returns

The updated allocation.

Return type

Allocation

patch_allocation(allocation, patch)

Apply a JSON patch to the allocation.

Parameters
  • allocation – The value can be the name or ID of an allocation or a Allocation instance.

  • patch – JSON patch to apply.

Returns

The updated allocation.

Return type

Allocation

delete_allocation(allocation, ignore_missing=True)

Delete an allocation.

Parameters
  • allocation – The value can be the name or ID of an allocation or a Allocation instance.

  • ignore_missing (bool) – When set to False, an exception ResourceNotFound will be raised when the allocation could not be found. When set to True, no exception will be raised when attempting to delete a non-existent allocation.

Returns

The instance of the allocation which was deleted.

Return type

Allocation.

wait_for_allocation(allocation, timeout=None, ignore_error=False)

Wait for the allocation to become active.

Parameters
  • allocation – The value can be the name or ID of an allocation or a Allocation instance.

  • timeout – How much (in seconds) to wait for the allocation. The value of None (the default) means no client-side timeout.

  • ignore_error – If True, this call will raise an exception if the allocation reaches the error state. Otherwise the error state is considered successful and the call returns.

Returns

The instance of the allocation.

Return type

Allocation.

Raises

ResourceFailure if allocation fails and ignore_error is False.

Raises

ResourceTimeout on timeout.

Volume Connector Operations

class openstack.baremetal.v1._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
volume_connectors(details=False, **query)

Retrieve a generator of volume_connector.

Parameters
  • details – A boolean indicating whether the detailed information for every volume_connector should be returned.

  • query (dict) –

    Optional query parameters to be sent to restrict the volume_connectors returned. Available parameters include:

    • fields: A list containing one or more fields to be returned in the response. This may lead to some performance gain because other fields of the resource are not refreshed.

    • limit: Requests at most the specified number of volume_connector be returned from the query.

    • marker: Specifies the ID of the last-seen volume_connector. Use the limit parameter to make an initial limited request and use the ID of the last-seen volume_connector from the response as the marker value in subsequent limited request.

    • node:only return the ones associated with this specific node (name or UUID), or an empty set if not found.

    • sort_dir:Sorts the response by the requested sort direction. A valid value is asc (ascending) or desc (descending). Default is asc. You can specify multiple pairs of sort key and sort direction query parameters. If you omit the sort direction in a pair, the API uses the natural sorting direction of the server attribute that is provided as the sort_key.

    • sort_key: Sorts the response by the this attribute value. Default is id. You can specify multiple pairs of sort key and sort direction query parameters. If you omit the sort direction in a pair, the API uses the natural sorting direction of the server attribute that is provided as the sort_key.

Returns

A generator of volume_connector instances.

create_volume_connector(**attrs)

Create a new volume_connector from attributes.

Parameters

attrs (dict) – Keyword arguments that will be used to create a VolumeConnector.

Returns

The results of volume_connector creation.

Return type

VolumeConnector.

find_volume_connector(vc_id, ignore_missing=True)

Find a single volume connector.

Parameters
  • vc_id (str) – The ID of a volume connector.

  • ignore_missing (bool) – When set to False, an exception of ResourceNotFound will be raised when the volume connector does not exist. When set to True`, None will be returned when attempting to find a nonexistent volume connector.

Returns

One VolumeConnector object or None.

get_volume_connector(volume_connector, fields=None)

Get a specific volume_connector.

Parameters
  • volume_connector – The value can be the ID of a volume_connector or a VolumeConnector instance.

  • fields – Limit the resource fields to fetch.`

Returns

One :class: ~openstack.baremetal.v1.volume_connector.VolumeConnector

Raises

ResourceNotFound when no volume_connector matching the name or ID could be found.`

update_volume_connector(volume_connector, **attrs)

Update a volume_connector.

Parameters
  • volume_connector – Either the ID of a volume_connector or an instance of VolumeConnector.

  • attrs (dict) – The attributes to update on the volume_connector represented by the volume_connector parameter.

Returns

The updated volume_connector.

Return type

VolumeConnector

patch_volume_connector(volume_connector, patch)

Apply a JSON patch to the volume_connector.

Parameters
  • volume_connector – The value can be the ID of a volume_connector or a VolumeConnector instance.

  • patch – JSON patch to apply.

Returns

The updated volume_connector.

Return type

delete_volume_connector(volume_connector, ignore_missing=True)

Delete an volume_connector.

Parameters
  • volume_connector – The value can be either the ID of a volume_connector.VolumeConnector or a VolumeConnector instance.

  • ignore_missing (bool) – When set to False, an exception ResourceNotFound will be raised when the volume_connector could not be found. When set to True, no exception will be raised when attempting to delete a non-existent volume_connector.

Returns

The instance of the volume_connector which was deleted.

Return type

VolumeConnector.

Volume Target Operations

class openstack.baremetal.v1._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
volume_targets(details=False, **query)

Retrieve a generator of volume_target.

Parameters
  • details – A boolean indicating whether the detailed information for every volume_target should be returned.

  • query (dict) –

    Optional query parameters to be sent to restrict the volume_targets returned. Available parameters include:

    • fields: A list containing one or more fields to be returned in the response. This may lead to some performance gain because other fields of the resource are not refreshed.

    • limit: Requests at most the specified number of volume_connector be returned from the query.

    • marker: Specifies the ID of the last-seen volume_target. Use the limit parameter to make an initial limited request and use the ID of the last-seen volume_target from the response as the marker value in subsequent limited request.

    • node:only return the ones associated with this specific node (name or UUID), or an empty set if not found.

    • sort_dir:Sorts the response by the requested sort direction. A valid value is asc (ascending) or desc (descending). Default is asc. You can specify multiple pairs of sort key and sort direction query parameters. If you omit the sort direction in a pair, the API uses the natural sorting direction of the server attribute that is provided as the sort_key.

    • sort_key: Sorts the response by the this attribute value. Default is id. You can specify multiple pairs of sort key and sort direction query parameters. If you omit the sort direction in a pair, the API uses the natural sorting direction of the server attribute that is provided as the sort_key.

Returns

A generator of volume_target instances.

create_volume_target(**attrs)

Create a new volume_target from attributes.

Parameters

attrs (dict) – Keyword arguments that will be used to create a VolumeTarget.

Returns

The results of volume_target creation.

Return type

VolumeTarget.

find_volume_target(vt_id, ignore_missing=True)

Find a single volume target.

Parameters
  • vt_id (str) – The ID of a volume target.

  • ignore_missing (bool) – When set to False, an exception of ResourceNotFound will be raised when the volume connector does not exist. When set to True`, None will be returned when attempting to find a nonexistent volume target.

Returns

One VolumeTarget object or None.

get_volume_target(volume_target, fields=None)

Get a specific volume_target.

Parameters
  • volume_target – The value can be the ID of a volume_target or a VolumeTarget instance.

  • fields – Limit the resource fields to fetch.`

Returns

One VolumeTarget

Raises

ResourceNotFound when no volume_target matching the name or ID could be found.`

update_volume_target(volume_target, **attrs)

Update a volume_target.

Parameters
  • volume_target – Either the ID of a volume_target or an instance of VolumeTarget.

  • attrs (dict) – The attributes to update on the volume_target represented by the volume_target parameter.

Returns

The updated volume_target.

Return type

VolumeTarget

patch_volume_target(volume_target, patch)

Apply a JSON patch to the volume_target.

Parameters
  • volume_target – The value can be the ID of a volume_target or a VolumeTarget instance.

  • patch – JSON patch to apply.

Returns

The updated volume_target.

Return type

delete_volume_target(volume_target, ignore_missing=True)

Delete an volume_target.

Parameters
  • volume_target – The value can be either the ID of a volume_target.VolumeTarget or a VolumeTarget instance.

  • ignore_missing (bool) – When set to False, an exception ResourceNotFound will be raised when the volume_target could not be found. When set to True, no exception will be raised when attempting to delete a non-existent volume_target.

Returns

The instance of the volume_target which was deleted.

Return type

VolumeTarget.

Deploy Template Operations

class openstack.baremetal.v1._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
deploy_templates(details=False, **query)

Retrieve a generator of deploy_templates.

Parameters
  • details – A boolean indicating whether the detailed information for every deploy_templates should be returned.

  • query (dict) – Optional query parameters to be sent to restrict the deploy_templates to be returned.

Returns

A generator of Deploy templates instances.

create_deploy_template(**attrs)

Create a new deploy_template from attributes.

Parameters

attrs (dict) – Keyword arguments that will be used to create a DeployTemplate.

Returns

The results of deploy_template creation.

Return type

DeployTemplate.

update_deploy_template(deploy_template, **attrs)

Update a deploy_template.

Parameters
  • deploy_template – Either the ID of a deploy_template, or an instance of DeployTemplate.

  • attrs (dict) – The attributes to update on the deploy_template represented by the deploy_template parameter.

Returns

The updated deploy_template.

Return type

DeployTemplate

delete_deploy_template(deploy_template, ignore_missing=True)

Delete a deploy_template.

:param deploy_template:The value can be

either the ID of a deploy_template or a DeployTemplate instance.

Parameters

ignore_missing (bool) – When set to False, an exception:class:~openstack.exceptions.ResourceNotFound will be raised when the deploy_template could not be found. When set to True, no exception will be raised when attempting to delete a non-existent deploy_template.

Returns

The instance of the deploy_template which was deleted.

Return type

DeployTemplate.

get_deploy_template(deploy_template, fields=None)

Get a specific deployment template.

Parameters
  • deploy_template – The value can be the name or ID of a deployment template DeployTemplate instance.

  • fields – Limit the resource fields to fetch.

Returns

One DeployTemplate

Raises

ResourceNotFound when no deployment template matching the name or ID could be found.

patch_deploy_template(deploy_template, patch)

Apply a JSON patch to the deploy_templates.

Parameters
  • deploy_templates – The value can be the ID of a deploy_template or a DeployTemplate instance.

  • patch – JSON patch to apply.

Returns

The updated deploy_template.

Return type

DeployTemplate

Utilities

Building config drives

Helpers for building configdrive compatible with the Bare Metal service.