Placement API

The Placement Class

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

Resource Classes

class openstack.placement.v1._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
create_resource_class(**attrs)

Create a new resource class from attributes.

Parameters:

attrs – Keyword arguments which will be used to create a ResourceClass, comprised of the properties on the ResourceClass class.

Returns:

The results of resource class creation

Return type:

ResourceClass

delete_resource_class(resource_class, ignore_missing=True)

Delete a resource class

Parameters:
  • resource_class – The value can be either the ID of a resource class or an ResourceClass, instance.

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the resource class does not exist. When set to True, no exception will be set when attempting to delete a nonexistent resource class.

Returns:

None

update_resource_class(resource_class, **attrs)

Update a resource class

Parameters:
  • resource_class – The value can be either the ID of a resource class or an ResourceClass, instance.

  • attrs – The attributes to update on the resource class represented by resource_class.

Returns:

The updated resource class

Return type:

ResourceClass

get_resource_class(resource_class)

Get a single resource_class.

Parameters:

resource_class – The value can be either the ID of a resource class or an ResourceClass, instance.

Returns:

An instance of ResourceClass

Raises:

ResourceNotFound when no resource class matching the criteria could be found.

resource_classes(**query)

Retrieve a generator of resource classs.

Parameters:

query (kwargs) – Optional query parameters to be sent to restrict the resource classs to be returned.

Returns:

A generator of resource class instances.

Resource Providers

class openstack.placement.v1._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
create_resource_provider(**attrs)

Create a new resource provider from attributes.

Parameters:

attrs – Keyword arguments which will be used to create a ResourceProvider, comprised of the properties on the ResourceProvider class.

Returns:

The results of resource provider creation

Return type:

ResourceProvider

delete_resource_provider(resource_provider, ignore_missing=True)

Delete a resource provider

Parameters:
  • resource_provider – The value can be either the ID of a resource provider or an ResourceProvider, instance.

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the resource provider does not exist. When set to True, no exception will be set when attempting to delete a nonexistent resource provider.

Returns:

None

update_resource_provider(resource_provider, **attrs)

Update a resource provider

Parameters:
  • resource_provider – The value can be either the ID of a resource provider or an ResourceProvider, instance.

  • attrs – The attributes to update on the resource provider represented by resource_provider.

Returns:

The updated resource provider

Return type:

ResourceProvider

get_resource_provider(resource_provider)

Get a single resource_provider.

Parameters:

resource_provider – The value can be either the ID of a resource provider or an ResourceProvider, instance.

Returns:

An instance of ResourceProvider

Raises:

ResourceNotFound when no resource provider matching the criteria could be found.

find_resource_provider(name_or_id, ignore_missing=True)

Find a single resource_provider.

Parameters:
  • name_or_id – The name or ID of a resource provider.

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

Returns:

An instance of ResourceProvider

Raises:

ResourceNotFound when no resource provider matching the criteria could be found.

resource_providers(**query)

Retrieve a generator of resource providers.

Parameters:

query (kwargs) – Optional query parameters to be sent to restrict the resource providers to be returned.

Returns:

A generator of resource provider instances.

get_resource_provider_aggregates(resource_provider)

Get a list of aggregates for a resource provider.

Parameters:

resource_provider – The value can be either the ID of a resource provider or an ResourceProvider, instance.

Returns:

An instance of ResourceProvider with the aggregates attribute populated.

Raises:

ResourceNotFound when no resource provider matching the criteria could be found.

set_resource_provider_aggregates(resource_provider, *aggregates)

Update aggregates for a resource provider.

Parameters:
  • resource_provider – The value can be either the ID of a resource provider or an ResourceProvider, instance.

  • aggregates – A list of aggregates. These aggregates will replace all aggregates currently present.

Returns:

An instance of ResourceProvider with the aggregates attribute populated with the updated value.

Raises:

ResourceNotFound when no resource provider matching the criteria could be found.

Resource Provider Inventories

class openstack.placement.v1._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
create_resource_provider_inventory(resource_provider, resource_class, *, total, **attrs)

Create a new resource provider inventory from attributes

Parameters:
  • resource_provider – Either the ID of a resource provider or a ResourceProvider instance.

  • total – The actual amount of the resource that the provider can accommodate.

  • attrs – Keyword arguments which will be used to create a ResourceProviderInventory, comprised of the properties on the ResourceProviderInventory class.

Returns:

The results of resource provider inventory creation

Return type:

ResourceProviderInventory

delete_resource_provider_inventory(resource_provider_inventory, resource_provider=None, ignore_missing=True)

Delete a resource provider inventory

Parameters:
  • resource_provider_inventory – The value can be either the ID of a resource provider or an ResourceProviderInventory, instance.

  • resource_provider – Either the ID of a resource provider or a ResourceProvider instance. This value must be specified when resource_provider_inventory is an ID.

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the resource provider inventory does not exist. When set to True, no exception will be set when attempting to delete a nonexistent resource provider inventory.

Returns:

None

update_resource_provider_inventory(resource_provider_inventory, resource_provider=None, *, resource_provider_generation=None, **attrs)

Update a resource provider’s inventory

Parameters:
  • resource_provider_inventory – The value can be either the ID of a resource provider inventory or an ResourceProviderInventory, instance.

  • resource_provider – Either the ID of a resource provider or a ResourceProvider instance. This value must be specified when resource_provider_inventory is an ID.

Attrs kwargs:

The attributes to update on the resource provider inventory represented by resource_provider_inventory.

Returns:

The updated resource provider inventory

Return type:

ResourceProviderInventory

get_resource_provider_inventory(resource_provider_inventory, resource_provider=None)

Get a single resource_provider_inventory

Parameters:
  • resource_provider_inventory – The value can be either the ID of a resource provider inventory or an ResourceProviderInventory, instance.

  • resource_provider – Either the ID of a resource provider or a ResourceProvider instance. This value must be specified when resource_provider_inventory is an ID.

Returns:

An instance of ResourceProviderInventory

Raises:

ResourceNotFound when no resource provider inventory matching the criteria could be found.

resource_provider_inventories(resource_provider, **query)

Retrieve a generator of resource provider inventories

Parameters:
  • resource_provider – Either the ID of a resource provider or a ResourceProvider instance.

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

Returns:

A generator of resource provider inventory instances.

Traits

class openstack.placement.v1._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
create_trait(name)

Create a new trait

Parameters:

name – The name of the new trait

Returns:

The results of trait creation

Return type:

Trait

delete_trait(trait, ignore_missing=True)

Delete a trait

Parameters:
  • trait – The value can be either the ID of a trait or an Trait, instance.

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the resource provider inventory does not exist. When set to True, no exception will be set when attempting to delete a nonexistent resource provider inventory.

Returns:

None

get_trait(trait)

Get a single trait

Parameters:

trait – The value can be either the ID of a trait or an Trait, instance.

Returns:

An instance of ResourceProviderInventory

Raises:

ResourceNotFound when no trait matching the criteria could be found.

traits(**query)

Retrieve a generator of traits

Parameters:

query – Optional query parameters to be sent to limit the resources being returned.

Returns:

A generator of trait objects