Merge "Add INVENTORY_INUSE to DELETE /rp/{u}/inventories"

This commit is contained in:
Zuul 2018-05-15 17:16:52 +00:00 committed by Gerrit Code Review
commit 2fd7ae67a2
2 changed files with 15 additions and 1 deletions

View File

@ -362,7 +362,8 @@ def delete_inventories(req):
except exception.InventoryInUse as ex:
# NOTE(mriedem): This message cannot change without impacting the
# nova.scheduler.client.report._RE_INV_IN_USE regex.
raise webob.exc.HTTPConflict(ex.format_message())
raise webob.exc.HTTPConflict(ex.format_message(),
comment=errors.INVENTORY_INUSE)
response = req.response
response.status = 204

View File

@ -55,6 +55,19 @@ tests:
response_strings:
- "Inventory for 'VCPU, DISK_GB' on resource provider '$ENVIRON['RP_UUID']' in use"
- name: fail to delete all inventory 1.23
DELETE: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
accept: application/json
openstack-api-version: placement 1.23
status: 409
response_headers:
content-type: /application/json/
response_strings:
- "Inventory for 'VCPU, DISK_GB' on resource provider '$ENVIRON['RP_UUID']' in use"
response_json_paths:
$.errors[0].code: placement.inventory.inuse
- name: get total usages by project
GET: /usages?project_id=$ENVIRON['PROJECT_ID']
request_headers: