[placement] correct error on bad resource class in allocation
A 400 is returned when making an allocation with a resource class that does not exist, however the error message refers to whatever the most recent resource provider uuid was rather than the one that was given the bad resource class. Since the exception happens outside the loop that creates the allocations we don't have the association to resource provider uuid, but we do know which consumer uuid, so report that instead. Change-Id: I81dc6b566c6cca0b7d2ac267c3e632c8ae8cfb47 Closes-Bug: #1714402
This commit is contained in:
parent
a4c917123d
commit
d88d42d591
nova
api/openstack/placement/handlers
tests/functional/api/openstack/placement/gabbits
@ -257,9 +257,9 @@ def _set_allocations(req, schema):
|
||||
# capacity limits have been exceeded.
|
||||
except exception.NotFound as exc:
|
||||
raise webob.exc.HTTPBadRequest(
|
||||
_("Unable to allocate inventory for resource provider "
|
||||
"%(rp_uuid)s: %(error)s") %
|
||||
{'rp_uuid': resource_provider_uuid, 'error': exc})
|
||||
_("Unable to allocate inventory for consumer "
|
||||
"%(consumer_uuid)s: %(error)s") %
|
||||
{'consumer_uuid': consumer_uuid, 'error': exc})
|
||||
except exception.InvalidInventory as exc:
|
||||
raise webob.exc.HTTPConflict(
|
||||
_('Unable to allocate inventory: %(error)s') % {'error': exc})
|
||||
|
@ -192,6 +192,7 @@ tests:
|
||||
COWS: 12
|
||||
status: 400
|
||||
response_strings:
|
||||
- Unable to allocate inventory for consumer
|
||||
- No such resource class COWS
|
||||
response_json_paths:
|
||||
$.errors[0].title: Bad Request
|
||||
|
Loading…
x
Reference in New Issue
Block a user