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, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
- 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 withmaintenanceset toTrueorFalse.limit: Requests at most the specified number of nodes be returned from the query.marker: Specifies the ID of the last-seen node. Use thelimitparameter to make an initial limited request and use the ID of the last-seen node from the response as themarkervalue in a subsequent limited request.provision_state: Only return those nodes with the specifiedprovision_state.resource_class: Only return those with the specifiedresource_class.shard: Only return nodes matching the supplied shard key.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.
See
create()for an explanation of the initial provision state.
- find_node(name_or_id, ignore_missing=True, *, details=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 ofNotFoundExceptionwill be raised when the node does not exist. When set to True`, None will be returned when attempting to find a nonexistent node.details – A boolean indicating whether the detailed information for the node should be returned.
- Returns:
One
Nodeobject 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
Nodeinstance.fields – Limit the resource fields to fetch.
- Returns:
One
Node- Raises:
NotFoundExceptionwhen 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
Nodeinstance.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
nodeparameter.
- 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
Nodeinstance.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
Nodeinstance.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 ``rebuildtargets. You can use functions fromopenstack.baremetal.configdriveto build it.clean_steps – Clean steps to execute, only valid for
cleantarget.rescue_password – Password for the rescue operation, only valid for
rescuetarget.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
waitis 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
activeandrebuildtarget.
- Returns:
The updated
Node- Raises:
ValueError if
config_drive,clean_steps,deploy_stepsorrescue_passwordare provided with an invalidtarget.
- get_node_boot_device(node)
Get node boot device
- Parameters:
node – The value can be the name or ID of a node or a
Nodeinstance.- Returns:
The node boot device
- set_node_boot_device(node, boot_device, persistent=False)
Set node boot device
- get_node_supported_boot_devices(node)
Get supported boot devices for node
- Parameters:
node – The value can be the name or ID of a node or a
Nodeinstance.- Returns:
The node boot device
- set_node_boot_mode(node, target)
Make a request to change node’s boot mode
- Parameters:
node – The value can be the name or ID of a node or a
Nodeinstance.target – Boot mode to set for node, one of either ‘uefi’/’bios’.
- set_node_secure_boot(node, target)
Make a request to change node’s secure boot state
- Parameters:
node – The value can be the name or ID of a node or a
Nodeinstance.target – Boolean indicating secure boot state to set. True/False corresponding to ‘on’/’off’ respectively.
- inject_nmi_to_node(node)
Inject NMI to node.
Injects a non-maskable interrupt (NMI) message to the node. This is used when response time is critical, such as during non-recoverable hardware errors. In addition, virsh inject-nmi is useful for triggering a crashdump in Windows guests.
- Parameters:
node – The value can be the name or ID of a node or a
Nodeinstance.- Returns:
None
- 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
Nodeinstance.expected_state – The expected provisioning state to reach.
timeout – If
waitis 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->manageabletransition isenrollagain.fail – If set to
Falsethis call will not raise on timeouts and provisioning failures.
- Returns:
If fail is
True(the default), the list ofNodeinstances that reached the requested state. If fail isFalse, aWaitResultnamed tuple.- Raises:
ResourceFailureif a node reaches an error state andabort_on_failed_stateisTrue.- Raises:
ResourceTimeouton 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
Nodeinstance.target – Target power state, one of
PowerActionor a string.wait – Whether to wait for the node to get into the expected state.
timeout – If
waitis 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
Nodeinstance.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
ValidationResultobjects.- Raises:
ValidationExceptionif 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
Nodeinstance.reason – Optional reason for maintenance.
- Returns:
This
Nodeinstance.
- 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
Nodeinstance.- Returns:
This
Nodeinstance.
- 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
Nodeinstance.ignore_missing (bool) – When set to
False, an exceptionNotFoundExceptionwill 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.
- 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
Nodeinstance.ignore_missing (bool) – When set to
False, an exceptionNotFoundExceptionwill 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.
- list_node_vendor_passthru(node)
Lists vendor_passthru for a node.
- Parameters:
node – The value can be the name or ID of a node or a
Nodeinstance.- Returns:
A list of vendor_passthru methods for the node.
- get_node_console(node)
Get the console for a node.
- Parameters:
node – The value can be the name or ID of a node or a
Nodeinstance.- Returns:
Connection information for the console.
- enable_node_console(node)
Enable the console for a node.
- Parameters:
node – The value can be the name or ID of a node or a
Nodeinstance.- Returns:
None
- disable_node_console(node)
Disable the console for a node.
- Parameters:
node – The value can be the name or ID of a node or a
Nodeinstance.- Returns:
None
Node Trait Operations¶
- class openstack.baremetal.v1._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
- add_node_trait(node, trait)
Add a trait to a node.
- Parameters:
node – The value can be the name or ID of a node or a
Nodeinstance.trait – trait to remove from the node.
- Returns:
The updated node
- remove_node_trait(node, trait, ignore_missing=True)
Remove a trait from a node.
- Parameters:
node – The value can be the name or ID of a node or a
Nodeinstance.trait – trait to remove from the node.
ignore_missing (bool) – When set to
False, an exceptionNotFoundExceptionwill be raised when the trait could not be found. When set toTrue, no exception will be raised when attempting to delete a non-existent trait.
- Returns:
The updated
Node
Port Operations¶
- class openstack.baremetal.v1._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
- 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 thelimitparameter to make an initial limited request and use the ID of the last-seen port from the response as themarkervalue 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, *, details=True)
Find a single port.
- Parameters:
name_or_id (str) – The ID of a port.
ignore_missing (bool) – When set to
False, an exception ofNotFoundExceptionwill be raised when the port does not exist. When set to True`, None will be returned when attempting to find a nonexistent port.details – A boolean indicating whether the detailed information for every port should be returned.
- Returns:
One
Portobject or None.
- get_port(port, fields=None)
Get a specific port.
- Parameters:
port – The value can be the ID of a port or a
Portinstance.fields – Limit the resource fields to fetch.
- Returns:
One
Port- Raises:
NotFoundExceptionwhen no port matching the name or ID could be found.
- 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
Portinstance.ignore_missing (bool) – When set to
False, an exceptionNotFoundExceptionwill 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, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
- 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 thelimitparameter to make an initial limited request and use the ID of the last-seen portgroup from the response as themarkervalue 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, *, details=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 ofNotFoundExceptionwill 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.details – A boolean indicating whether the detailed information for the port group should be returned.
- Returns:
One
PortGroupobject 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
PortGroupinstance.fields – Limit the resource fields to fetch.
- Returns:
One
PortGroup- Raises:
NotFoundExceptionwhen no port group matching the name or ID could be found.
- 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
PortGroupinstance.ignore_missing (bool) – When set to
False, an exceptionNotFoundExceptionwill 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, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
- 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
Driverinstance.- Returns:
One
Driver- Raises:
NotFoundExceptionwhen no driver matching the name could be found.
Chassis Operations¶
- class openstack.baremetal.v1._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
- 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 thelimitparameter to make an initial limited request and use the ID of the last-seen chassis from the response as themarkervalue 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, *, details=True)
Find a single chassis.
- Parameters:
name_or_id (str) – The ID of a chassis.
ignore_missing (bool) – When set to
False, an exception ofNotFoundExceptionwill be raised when the chassis does not exist. When set to True`, None will be returned when attempting to find a nonexistent chassis.details – A boolean indicating whether the detailed information for the chassis should be returned.
- Returns:
One
Chassisobject or None.
- get_chassis(chassis, fields=None)
Get a specific chassis.
- Parameters:
chassis – The value can be the ID of a chassis or a
Chassisinstance.fields – Limit the resource fields to fetch.
- Returns:
One
Chassis- Raises:
NotFoundExceptionwhen no chassis matching the name or ID could be found.
- 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
Chassisinstance.ignore_missing (bool) – When set to
False, an exceptionNotFoundExceptionwill 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:
Virtual Media Operations¶
- class openstack.baremetal.v1._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
- attach_vmedia_to_node(node, device_type, image_url, image_download_source=None, retry_on_conflict=True)
Attach virtual media device to a node.
- Parameters:
node – The value can be either the name or ID of a node or a
Nodeinstance.device_type – The type of virtual media device.
image_url – The URL of the image to attach.
image_download_source – The source of the image download.
retry_on_conflict – Whether to retry HTTP CONFLICT errors. This can happen when either the virtual media 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:
NotSupportedif the server does not support the VMEDIA API.
- detach_vmedia_from_node(node, device_types=None)
Detach virtual media from the node.
- Parameters:
node – The value can be either the name or ID of a node or a
Nodeinstance.device_types – A list with the types of virtual media devices to detach.
- Returns:
Trueif the virtual media was detached, otherwiseFalse.- Raises:
NotSupportedif the server does not support the VMEDIA API.
VIF Operations¶
- class openstack.baremetal.v1._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
- attach_vif_to_node(node, vif_id, retry_on_conflict=True, *, port_id=None, port_group_id=None)
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
Nodeinstance.vif_id – 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.
port_id – The UUID of the port to attach the VIF to. Only one of port_id or port_group_id can be provided.
port_group_id – The UUID of the portgroup to attach to. Only one of port_group_id or port_id can be provided.
- Returns:
None
- Raises:
NotSupportedif the server does not support the VIF API.- Raises:
InvalidRequestif both port_id and port_group_id are provided.
- 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
Nodeinstance.vif_id (string) – Backend-specific VIF ID.
ignore_missing (bool) – When set to
FalseNotFoundExceptionwill be raised when the VIF does not exist. Otherwise,Falseis returned.
- Returns:
Trueif the VIF was detached, otherwiseFalse.- Raises:
NotSupportedif 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
Nodeinstance.- Returns:
List of VIF IDs as strings.
- Raises:
NotSupportedif the server does not support the VIF API.
Allocation Operations¶
- class openstack.baremetal.v1._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
- 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 thelimitparameter to make an initial limited request and use the ID of the last-seen allocation from the response as themarkervalue 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
Allocationinstance.fields – Limit the resource fields to fetch.
- Returns:
One
Allocation- Raises:
NotFoundExceptionwhen 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
Allocationinstance.attrs (dict) – The attributes to update on the allocation represented by the
allocationparameter.
- 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
Allocationinstance.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
Allocationinstance.ignore_missing (bool) – When set to
False, an exceptionNotFoundExceptionwill 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
Allocationinstance.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 theerrorstate. Otherwise the error state is considered successful and the call returns.
- Returns:
The instance of the allocation.
- Return type:
- Raises:
ResourceFailureif allocation fails andignore_errorisFalse.- Raises:
ResourceTimeouton timeout.
Volume Connector Operations¶
- class openstack.baremetal.v1._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
- 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 thelimitparameter to make an initial limited request and use the ID of the last-seen volume_connector from the response as themarkervalue 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, *, details=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 ofNotFoundExceptionwill 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.details – A boolean indicating whether the detailed information for the volume connector should be returned.
- Returns:
One
VolumeConnectorobject 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
VolumeConnectorinstance.fields – Limit the resource fields to fetch.`
- Returns:
One :class: ~openstack.baremetal.v1.volume_connector.VolumeConnector
- Raises:
NotFoundExceptionwhen 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_connectorparameter.
- 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
VolumeConnectorinstance.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
VolumeConnectorinstance.ignore_missing (bool) – When set to
False, an exceptionNotFoundExceptionwill 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, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
- 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 thelimitparameter to make an initial limited request and use the ID of the last-seen volume_target from the response as themarkervalue 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, *, details=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 ofNotFoundExceptionwill 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.details – A boolean indicating whether the detailed information for the volume target should be returned.
- Returns:
One
VolumeTargetobject 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
VolumeTargetinstance.fields – Limit the resource fields to fetch.`
- Returns:
One
VolumeTarget- Raises:
NotFoundExceptionwhen 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_targetparameter.
- 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
VolumeTargetinstance.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
VolumeTargetinstance.ignore_missing (bool) – When set to
False, an exceptionNotFoundExceptionwill 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, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
- 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_templateparameter.
- 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
DeployTemplateinstance.
- Parameters:
ignore_missing (bool) – When set to
False, an exception:class:~openstack.exceptions.NotFoundException 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
DeployTemplateinstance.fields – Limit the resource fields to fetch.
- Returns:
One
DeployTemplate- Raises:
NotFoundExceptionwhen 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
DeployTemplateinstance.patch – JSON patch to apply.
- Returns:
The updated deploy_template.
- Return type:
Runbook Operations¶
- class openstack.baremetal.v1._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
- runbooks(details=False, **query)
Retrieve a generator of runbooks.
- Parameters:
details – A boolean indicating whether the detailed information for every runbook should be returned.
query (dict) – Optional query parameters to be sent to restrict the runbooks to be returned.
- Returns:
A generator of Runbooks instances.
- create_runbook(**attrs)
Create a new runbook from attributes.
- update_runbook(runbook, **attrs)
Update a runbook.
- delete_runbook(runbook, ignore_missing=True)
Delete a runbook.
- :param runbook:The value can be
either the ID of a runbook or a
Runbookinstance.
- Parameters:
ignore_missing (bool) – When set to
False, an exception:class:~openstack.exceptions.NotFoundException will be raised when the runbook could not be found. When set toTrue, no exception will be raised when attempting to delete a non-existent runbook.- Returns:
The instance of the runbook which was deleted.
- Return type:
- get_runbook(runbook, fields=None)
Get a specific runbook.
- Parameters:
runbook – The value can be the name or ID of a runbook
Runbookinstance.fields – Limit the resource fields to fetch.
- Returns:
One
Runbook- Raises:
NotFoundExceptionwhen no runbook matching the name or ID could be found.
Inspection Rule Operations¶
- class openstack.baremetal.v1._proxy.Proxy(session, *, service_type=None, service_name=None, interface=None, region_name=None, endpoint_override=None, version=None, auth=None, user_agent=None, connect_retries=None, logger=None, allow=None, additional_headers=None, client_name=None, client_version=None, allow_version_hack=None, global_request_id=None, min_version=None, max_version=None, default_microversion=None, status_code_retries=None, retriable_status_codes=None, raise_exc=None, rate_limit=None, concurrency=None, connect_retry_delay=None, status_code_retry_delay=None, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None)
- inspection_rules(details=False, **query)
Retrieve a generator of inspection rules.
- Parameters:
query (dict) – Optional query parameters to be sent to restrict the inspection rules to be returned.
- Returns:
A generator of InspectionRule instances.
- create_inspection_rule(**attrs)
Create a new inspection rule from attributes.
- Parameters:
attrs (dict) – Keyword arguments that will be used to create a
InspectionRule.- Returns:
The results of inspection rule creation.
- Return type:
- get_inspection_rule(inspection_rule, fields=None)
Get a specific inspection rule.
- Parameters:
inspection_rule – The ID of an inspection rule
InspectionRuleinstance.fields – Limit the resource fields to fetch.
- Returns:
One
InspectionRule- Raises:
NotFoundExceptionwhen no inspection rule matching the ID could be found.
- update_inspection_rule(inspection_rule, **attrs)
Update an inspection rule.
- Parameters:
inspection_rule – Either the ID of an inspection rule or an instance of
InspectionRule.attrs (dict) – The attributes to update on the inspection rule represented by the
inspection_ruleparameter.
- Returns:
The updated inspection rule.
- Return type:
- delete_inspection_rule(inspection_rule, ignore_missing=True)
Delete an inspection rule.
- Parameters:
inspection_rule – The value can be either the ID of a inspection_rule or a
InspectionRuleinstance.ignore_missing (bool) – When set to
False, an exceptionNotFoundExceptionwill be raised when the inspection rule could not be found. When set toTrue, no exception will be raised when attempting to delete a non-existent inspection rule.
- Returns:
The instance of the inspection rule which was deleted.
- Return type:
- patch_inspection_rule(inspection_rule, patch)
Apply a JSON patch to the inspection rule.
- Parameters:
inspection_rule – The value can be the ID of a inspection_rule or a
InspectionRuleinstance.patch – JSON patch to apply.
- Returns:
The updated inspection rule.
- Return type:
Utilities¶
Building config drives¶
Helpers for building configdrive compatible with the Bare Metal service.