Merge "Fix 409 handling in report client when deleting inventory"
This commit is contained in:
commit
2e75b91026
@ -409,11 +409,10 @@ def delete_inventories(req):
|
||||
'%(rp_uuid)s because the inventory was updated by '
|
||||
'another process. Please retry your request.')
|
||||
% {'rp_uuid': resource_provider.uuid})
|
||||
except exception.InventoryInUse:
|
||||
raise webob.exc.HTTPConflict(
|
||||
_('Unable to delete inventory for resource provider '
|
||||
'%(rp_uuid)s because the inventory is in use.')
|
||||
% {'rp_uuid': resource_provider.uuid})
|
||||
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(explanation=ex.format_message())
|
||||
|
||||
response = req.response
|
||||
response.status = 204
|
||||
|
@ -2101,6 +2101,8 @@ class InvalidInventory(Invalid):
|
||||
|
||||
|
||||
class InventoryInUse(InvalidInventory):
|
||||
# NOTE(mriedem): This message cannot change without impacting the
|
||||
# nova.scheduler.client.report._RE_INV_IN_USE regex.
|
||||
msg_fmt = _("Inventory for '%(resource_classes)s' on "
|
||||
"resource provider '%(resource_provider)s' in use.")
|
||||
|
||||
|
@ -40,7 +40,7 @@ tests:
|
||||
response_headers:
|
||||
content-type: /application/json/
|
||||
response_strings:
|
||||
- Unable to delete inventory for resource provider $ENVIRON['RP_UUID'] because the inventory is in use.
|
||||
- "Inventory for 'VCPU, DISK_GB' on resource provider '$ENVIRON['RP_UUID']' in use"
|
||||
|
||||
- name: get total usages by project
|
||||
GET: /usages?project_id=$ENVIRON['PROJECT_ID']
|
||||
|
Loading…
Reference in New Issue
Block a user