DELETE all inventories for a resource provider

This is a small feature request: Implement the DELETE method for all inventories for a resource provider. It is possible to delete a single inventory at a time, but there is no way to DELETE all inventories at once.

Problem description

Currently (version 1.4 or before of the placement API), in order to delete all inventory for a resource provider, one must call PUT /resource_providers/{uuid}/inventories and pass in the following request payload:

  'generation': <int>,
  'resources': {}

It would be easier and more intuitive to support DELETE /resource_providers/{uuid}/inventories with no request payload and returning a 204 No Content on success.

The existing method for deleting a single inventory is referenced below:

'DELETE': inventory.delete_inventory

Use Cases

As an operator or developer, I want to delete all inventories for a resource provider with the DELETE method using the placement api.

Proposed change

Add DELETE /resource_providers/{uuid}/inventories and return 204 no content on success. Changes include:

  • /nova/api/openstack/placement/handlers/, delete_inventories(req)

  • A release note advertising the additional placement REST API microversion and functionality

The handler file for should just take a call to DELETE /resource_providers/{uuid}/inventories and construct a call to ResourceProvider.set_inventory(), passing in an empty InventoryList() object.

We still want the DELETE /resource_providers/{uuid}/inventories call to return a 409 if the inventory is in use or if there was a concurrent attempt to update the inventory. Thus, reuse nova.objects.ResourceProvider.set_inventory() as much as possible.

There’s no need to modify anything in the nova/objects/


  • Continue non-intuitive delete of all inventory through the PUT method with empty resources in the request payload.

  • The other alternative is to get all inventories from a resource provider and use the DELETE method one at a time.

These methods are ugly and require a new microversion with a new method for deleting all inventories from a resource provider at once, which should report the appropriate return codes.

Data model impact


REST API impact

New API method: DELETE /resource_providers/{uuid}/inventories

Empty request payload.

Return 204 No Content on success.

Return 409 Conflict on the following errors:

  • resource generation out of sync

  • inventory in use

Security impact


Notifications impact


Other end user impact


Performance Impact


Other deployer impact


Developer impact




Primary assignee:

Rafael Folco <>

Other contributors:

Jay Pipes <>

Chris Dent <>

Work Items

  • Add a Reno with the REST API change

  • Add a new DELETE method to /resource_providers/{uuid}/inventories

  • Support the new DELETE method


None. The majority of the groundwork for this was completed in the Generic Resource Pools blueprint.


New API test(s) with the DELETE method will be added to nova/tests/functional/api/openstack/placement/gabbits/inventory.yaml.

Documentation Impact

The in-tree API reference will be updated for the placement REST API documentation.




Release Name