openstack.placement.v1.resource_provider

The ResourceProvider Class

The ResourceProvider class inherits from Resource.

class openstack.placement.v1.resource_provider.ResourceProvider(_synchronized=False, connection=None, **attrs)

The base resource

Parameters:
  • _synchronized – This is not intended to be used directly. See new() and existing().

  • connection – Reference to the Connection being used. Defaults to None to allow Resource objects to be used without an active Connection, such as in unit tests. Use of self._connection in Resource code should protect itself with a check for None.

resource_key = None

Singular form of key for resource.

resources_key = 'resource_providers'

Plural form of key for resource.

base_path = '/resource_providers'

The base part of the URI for this resource.

allow_create = True

Allow create operation for this resource.

allow_fetch = True

Allow get operation for this resource.

allow_commit = True

Allow update operation for this resource.

allow_delete = True

Allow delete operation for this resource.

allow_list = True

Allow list operation for this resource.

aggregates

Aggregates

id

The UUID of a resource provider.

generation

A consistent view marker that assists with the management of concurrent resource provider updates.

Links pertaining to this flavor. This is a list of dictionaries, each including keys href and rel.

name

The name of this resource provider.

parent_provider_id

The UUID of the immediate parent of the resource provider.

root_provider_id

Read-only UUID of the top-most provider in this provider tree.

usages

Resource class usage counts for this resource provider.

commit(session, prepend_key=True, has_body=True, retry_on_conflict=None, base_path=None, *, microversion=None, **kwargs)

Commit the state of the instance to the remote resource.

Parameters:
  • session – The session to use for making this request.

  • prepend_key – Whether the resource_key should be prepended in a resource creation request. Default to True.

  • retry_on_conflict – Whether to enable retries on HTTP CONFLICT (409). Value of None leaves the Adapter defaults.

  • base_path – Base part of the URI for modifying resources, if different from base_path.

  • microversion – API version to override the negotiated one.

  • attrs – Attributes to pass when updating the resource. These should correspond to either Body or Header values on the resource.

Returns:

This Resource instance.

Raises:

MethodNotSupported if Resource.allow_commit is not set to True.

set_inventories(session, inventories, resource_provider_generation)

Replace all inventory records for the resource provider.

Parameters:
  • session – The session to use for making this request.

  • inventories – A dict mapping resource class names to inventory configuration dicts. Pass an empty dict to remove all inventories.

  • resource_provider_generation – The generation of the resource provider; used to detect concurrent updates.

Returns:

The resource provider with the updated generation.

Raises:

ConflictException if the generation does not match or there are active allocations against an inventory being removed.

delete_inventories(session)

Delete all inventory records for the resource provider.

Parameters:

session – The session to use for making this request.

Raises:

ConflictException if there are active allocations against the resource provider.

fetch_usages(session)

Fetch resource usage counts for the resource provider

Parameters:

session – The session to use for making this request

Returns:

The resource provider with usages populated

fetch_aggregates(session)

List aggregates set on the resource provider

Parameters:

session – The session to use for making this request

Returns:

The resource provider with aggregates populated

set_aggregates(session, aggregates=None)

Replaces aggregates on the resource provider

Parameters:
  • session – The session to use for making this request

  • aggregates (list) – List of aggregates

Returns:

The resource provider with updated aggregates populated