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 aninstance_id
.conductor_group
: Only return those in the specifiedconductor_group
.driver
: Only return those with the specifieddriver
.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 withmaintenance
set toTrue
orFalse
.limit
: Requests at most the specified number of nodes be returned from the query.marker
: Specifies the ID of the last-seen node. Use thelimit
parameter to make an initial limited request and use the ID of the last-seen node from the response as themarker
value in a subsequent limited request.provision_state
: Only return those nodes with the specifiedprovision_state
.resource_class
: Only return those with the specifiedresource_class
.sort_dir
: Sorts the response by the requested sort direction. A valid value isasc
(ascending) ordesc
(descending). Default isasc
. 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 thesort_key
.sort_key
: Sorts the response by the this attribute value. Default isid
. 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 thesort_key
.
- Returns
A generator of
Node
- create_node(**attrs)
Create a new node from attributes.
- 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 ofResourceNotFound
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.
- 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
- 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
- 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 fromopenstack.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 toTrue
, specifies how much (in seconds) to wait for the expected state to be reached. The value ofNone
(the default) means no client-side timeout.deploy_steps – Deploy steps to execute, only valid for
active
andrebuild
target.
- Returns
The updated
Node
- Raises
ValueError if
config_drive
,clean_steps
,deploy_steps
orrescue_password
are provided with an invalidtarget
.
- 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 toTrue
, specifies how much (in seconds) to wait for the expected state to be reached. The value ofNone
(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 forenroll
->manageable
transition isenroll
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 ofNode
instances that reached the requested state. If fail isFalse
, aWaitResult
named tuple.- Raises
ResourceFailure
if a node reaches an error state andabort_on_failed_state
isTrue
.- 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 toTrue
, specifies how much (in seconds) to wait for the expected state to be reached. The value ofNone
(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.
- 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.
- 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 exceptionResourceNotFound
will be raised when the node could not be found. When set toTrue
, 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 specifieddriver
.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 thelimit
parameter to make an initial limited request and use the ID of the last-seen port from the response as themarker
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 isasc
(ascending) ordesc
(descending). Default isasc
. 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 thesort_key
.sort_key
: Sorts the response by the this attribute value. Default isid
. 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 thesort_key
.
- Returns
A generator of port instances.
- create_port(**attrs)
Create a new port from attributes.
- 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 ofResourceNotFound
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.
- update_port(port, **attrs)
Update a port.
- patch_port(port, patch)
Apply a JSON patch to the 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 exceptionResourceNotFound
will be raised when the port could not be found. When set toTrue
, 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 thelimit
parameter to make an initial limited request and use the ID of the last-seen portgroup from the response as themarker
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 isasc
(ascending) ordesc
(descending). Default isasc
. 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 thesort_key
.sort_key
: Sorts the response by the this attribute value. Default isid
. 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 thesort_key
.
- Returns
A generator of port group instances.
- create_port_group(**attrs)
Create a new portgroup from attributes.
- 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 ofResourceNotFound
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.
- update_port_group(port_group, **attrs)
Update a port group.
- patch_port_group(port_group, patch)
Apply a JSON patch to the port_group.
- 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 exceptionResourceNotFound
will be raised when the port group could not be found. When set toTrue
, 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
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.
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 thelimit
parameter to make an initial limited request and use the ID of the last-seen chassis from the response as themarker
value in a subsequent limited request.sort_dir
: Sorts the response by the requested sort direction. A valid value isasc
(ascending) ordesc
(descending). Default isasc
. 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 thesort_key
.sort_key
: Sorts the response by the this attribute value. Default isid
. 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 thesort_key
.
- Returns
A generator of chassis instances.
- create_chassis(**attrs)
Create a new chassis from attributes.
- 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 ofResourceNotFound
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.
- update_chassis(chassis, **attrs)
Update a chassis.
- patch_chassis(chassis, patch)
Apply a JSON patch to the 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 exceptionResourceNotFound
will be raised when the chassis could not be found. When set toTrue
, no exception will be raised when attempting to delete a non-existent chassis.
- Returns
The instance of the chassis which was deleted.
- Return type
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, otherwiseFalse
.- 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 thelimit
parameter to make an initial limited request and use the ID of the last-seen allocation from the response as themarker
value in a subsequent limited request.sort_dir
: Sorts the response by the requested sort direction. A valid value isasc
(ascending) ordesc
(descending). Default isasc
. 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 thesort_key
.sort_key
: Sorts the response by the this attribute value. Default isid
. 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 thesort_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
- 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
- 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
- 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 exceptionResourceNotFound
will be raised when the allocation could not be found. When set toTrue
, no exception will be raised when attempting to delete a non-existent allocation.
- Returns
The instance of the allocation which was deleted.
- Return type
- 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 theerror
state. Otherwise the error state is considered successful and the call returns.
- Returns
The instance of the allocation.
- Return type
- Raises
ResourceFailure
if allocation fails andignore_error
isFalse
.- 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 thelimit
parameter to make an initial limited request and use the ID of the last-seen volume_connector from the response as themarker
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 isasc
(ascending) ordesc
(descending). Default isasc
. 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 thesort_key
.sort_key
: Sorts the response by the this attribute value. Default isid
. 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 thesort_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
- 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 ofResourceNotFound
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
- 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 exceptionResourceNotFound
will be raised when the volume_connector could not be found. When set toTrue
, 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
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 thelimit
parameter to make an initial limited request and use the ID of the last-seen volume_target from the response as themarker
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 isasc
(ascending) ordesc
(descending). Default isasc
. 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 thesort_key
.sort_key
: Sorts the response by the this attribute value. Default isid
. 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 thesort_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
- 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 ofResourceNotFound
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
- 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 exceptionResourceNotFound
will be raised when the volume_target could not be found. When set toTrue
, 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
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
- 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
- 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 toTrue
, 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
- 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
Utilities¶
Building config drives¶
Helpers for building configdrive compatible with the Bare Metal service.