Stephen Finucane 15207b2070 placement: Add support for resource provider inventories
Unlike resource classes, this one is not easy. The list operation is
particularly tricky: unlike most OpenStack APIs that returns a list of
objects, the resource provider inventory list operation returns an
object with resource class as the keys and the inventory details as the
values. Put another way, we see:

  {
    "MEMORY_MB": { ... },
    "VCPU": { ... },
    ...
  }

instead of the more typical:

  [
    {
      "resource_class": "MEMORY_MB",
      ...
    },
    {
      "resource_class": "VCPU",
      ...
    },
    ...
  ]

This need special handling code, namely a reimplementation of the 'list'
class method.

In addition, updating inventory requires providing
'resource_provider_generation'. This should match the current server
value of this field, but by setting this SDK assumes the field is
unchanged and doesn't include it in the list of "dirty" attributes. This
requires manually adding the 'resource_provider_generation' value to the
list of 'dirty' fields before the 'commit' operation.

Change-Id: I5ea5d0a477147e1a4e30b428f17b44807253deaa
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-07-12 12:52:18 +01:00

1.2 KiB

Placement API

openstack.placement.v1._proxy

The Placement Class

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

Resource Classes

openstack.placement.v1._proxy.Proxy

Resource Providers

openstack.placement.v1._proxy.Proxy

Resource Provider Inventories

openstack.placement.v1._proxy.Proxy