Fix 409 handling in report client when deleting inventory
Change I30b51a3235e69f4a2993052f7f9ef853858f2d65 regressed a check added in I10b22606f704abcb970939fb2cd77f026d4d6322 which is meant to avoid dumping errors in the logs when the scheduler report client fails to delete compute node resource provider inventory since some resource class inventory is still in use. It's all very fragile since the check in the report client is dependent on a regex for the error message coming back from the Placement API, but until we have error codes in the API responses, this is what we have to deal with. This change puts the original error message back in the Placement API and adds notes for awareness. Change-Id: I9a9af0e3e04c7ea7314b7077a681d6a111de6e47 Closes-Bug: #1708031
This commit is contained in:
parent
1807d2edb0
commit
f6dc38ea7d
@ -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…
x
Reference in New Issue
Block a user