Merge "Fix 409 handling in report client when deleting inventory"

This commit is contained in:
Jenkins 2017-08-04 16:52:08 +00:00 committed by Gerrit Code Review
commit 2e75b91026
3 changed files with 7 additions and 6 deletions

View File

@ -409,11 +409,10 @@ def delete_inventories(req):
'%(rp_uuid)s because the inventory was updated by ' '%(rp_uuid)s because the inventory was updated by '
'another process. Please retry your request.') 'another process. Please retry your request.')
% {'rp_uuid': resource_provider.uuid}) % {'rp_uuid': resource_provider.uuid})
except exception.InventoryInUse: except exception.InventoryInUse as ex:
raise webob.exc.HTTPConflict( # NOTE(mriedem): This message cannot change without impacting the
_('Unable to delete inventory for resource provider ' # nova.scheduler.client.report._RE_INV_IN_USE regex.
'%(rp_uuid)s because the inventory is in use.') raise webob.exc.HTTPConflict(explanation=ex.format_message())
% {'rp_uuid': resource_provider.uuid})
response = req.response response = req.response
response.status = 204 response.status = 204

View File

@ -2101,6 +2101,8 @@ class InvalidInventory(Invalid):
class InventoryInUse(InvalidInventory): 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 " msg_fmt = _("Inventory for '%(resource_classes)s' on "
"resource provider '%(resource_provider)s' in use.") "resource provider '%(resource_provider)s' in use.")

View File

@ -40,7 +40,7 @@ tests:
response_headers: response_headers:
content-type: /application/json/ content-type: /application/json/
response_strings: 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 - name: get total usages by project
GET: /usages?project_id=$ENVIRON['PROJECT_ID'] GET: /usages?project_id=$ENVIRON['PROJECT_ID']