Baremetal API

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=None, task_manager=None, *args, **kwargs)
create_node(**attrs)

Create a new node from attributes.

Parameters:attrs (dict) – Keyword arguments that will be used to create a Node, it comprised of the properties on the Node class.
Returns:The results of node creation.
Return type:Node.
update_node(node, **attrs)

Update a node.

Parameters:
  • chassis – Either the name or the ID of a node or an instance of Node.
  • attrs (dict) – The attributes to update on the node represented by the node parameter.
Returns:

The updated node.

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 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.

get_node(node)

Get a specific node.

Parameters:node – The value can be the name or ID of a chassis or a Node instance.
Returns:One Node
Raises:ResourceNotFound when no node matching the name or ID could be found.
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.

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.
    • 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.
    • 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.
    • 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 node instances.

Port Operations

class openstack.baremetal.v1._proxy.Proxy(session=None, task_manager=None, *args, **kwargs)
create_port(**attrs)

Create a new port from attributes.

Parameters:attrs (dict) – Keyword arguments that will be used to create a Port, it comprises of the properties on the Port class.
Returns:The results of port creation.
Return type:Port.
update_port(port, **attrs)

Update a port.

Parameters:
  • chassis – Either the name or 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

delete_port(port, ignore_missing=True)

Delete a port.

Parameters:
  • port – The value can be either the name or 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.

get_port(port, **query)

Get a specific port.

Parameters:
  • port – The value can be the name or ID of a chassis or a Port instance.
  • query (dict) –

    Optional query parameters to be sent to restrict the port properties 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.
Returns:

One Port

Raises:

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

find_port(name_or_id, ignore_missing=True)

Find a single port.

Parameters:
  • name_or_id (str) – The name or 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.

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.

Port Group Operations

class openstack.baremetal.v1._proxy.Proxy(session=None, task_manager=None, *args, **kwargs)
create_port_group(**attrs)

Create a new portgroup from attributes.

Parameters:attrs (dict) – Keyword arguments that will be used to create a PortGroup, it comprises of the properties on the PortGroup class.
Returns:The results of portgroup creation.
Return type:PortGroup.
update_port_group(port_group, **attrs)

Update a port group.

Parameters:
  • chassis – 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

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.

get_port_group(port_group, **query)

Get a specific port group.

Parameters:
  • port_group – The value can be the name or ID of a chassis or a PortGroup instance.
  • query (dict) –

    Optional query parameters to be sent to restrict the port group properties 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.
Returns:

One PortGroup

Raises:

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

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.

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.

Driver Operations

class openstack.baremetal.v1._proxy.Proxy(session=None, task_manager=None, *args, **kwargs)
drivers()

Retrieve a generator of drivers.

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=None, task_manager=None, *args, **kwargs)
create_chassis(**attrs)

Create a new chassis from attributes.

Parameters:attrs (dict) – Keyword arguments that will be used to create a Chassis, it comprised of the properties on the Chassis class.
Returns:The results of chassis creation.
Return type:Chassis.
update_chassis(chassis, **attrs)

Update a chassis.

Parameters:
  • chassis – Either the name or 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

delete_chassis(chassis, ignore_missing=True)

Delete a chassis.

Parameters:
  • chassis – The value can be either the name or 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.

get_chassis(chassis)

Get a specific chassis.

Parameters:chassis – The value can be the name or ID of a chassis or a Chassis instance.
Returns:One Chassis
Raises:ResourceNotFound when no chassis matching the name or ID could be found.
find_chassis(name_or_id, ignore_missing=True)

Find a single chassis.

Parameters:
  • name_or_id (str) – The name or 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.

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.

Deprecated Methods

class openstack.baremetal.v1._proxy.Proxy(session=None, task_manager=None, *args, **kwargs)
create_portgroup(*args, **kwargs)

Create a new port group from attributes.

Parameters:attrs (dict) – Keyword arguments that will be used to create a PortGroup, it comprises of the properties on the PortGroup class.
Returns:The results of portgroup creation.
Return type:PortGroup.

Deprecated since version 0.9.14: This will be removed in 2.0.0. Use create_port_group instead

update_portgroup(*args, **kwargs)

Update a port group.

Parameters:
  • chassis – 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 portgroup parameter.
Returns:

The updated port group.

Return type:

PortGroup

Deprecated since version 0.9.14: This will be removed in 2.0.0. Use update_port_group instead

delete_portgroup(*args, **kwargs)

Delete a port group.

Parameters:
  • portgroup – 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.

Deprecated since version 0.9.14: This will be removed in 2.0.0. Use delete_port_group instead

get_portgroup(*args, **kwargs)

Get a specific port group.

Parameters:
  • portgroup – The value can be the name or ID of a chassis or a PortGroup instance.
  • query (dict) –

    Optional query parameters to be sent to restrict the portgroup properties 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.
Returns:

One PortGroup

Raises:

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

Deprecated since version 0.9.14: This will be removed in 2.0.0. Use get_port_group instead

find_portgroup(*args, **kwargs)

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.

Deprecated since version 0.9.14: This will be removed in 2.0.0. Use find_port_group instead

portgroups(*args, **kwargs)

Retrieve a generator of port groups.

Parameters:
  • details – A boolean indicating whether the detailed information for every portgroup should be returned.
  • query (dict) –

    Optional query parameters to be sent to restrict the portgroups 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 portgroup instances.

Deprecated since version 0.9.14: This will be removed in 2.0.0. Use port_groups instead

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.