commit dc85c089702a9819fdab7c951d427de838a3dcc6
Author: Chris Dent <email address hidden>
Date: Sat Jul 15 18:49:57 2017 +0100
[placement] fix 500 error when allocating to bad class
Adjust exception handling when calling set_allocations so that a
KeyError in the usage_map raises an InvalidInventory. When making
allocations against a resource provider with >1 resource classes
and where one of those resource classes does not have inventory on the
provider, we can attempt to get info out of the usage_map that is not
there, and get a KeyError. This catches the KeyError and turns it into
an InvalidInventory which eventually results in a 409 response,
consistent with other responses to bad allocations. Since this is fixing
a 500, no microversion required.
NOTE(mriedem): The functional test required some tweaks for Ocata since
we didn't have the 1.7 microversion in Ocata. In addition, inventories
in early days required that max_unit be set, otherwise it would default
to 0 and no allocations could be made. We might wish to consider that a
bug in older versions that we should fix?
Change-Id: I52fa02b56f8e62dfa206a3969a99fab250508760
Closes-Bug: #1704574
(cherry picked from commit 913149249cc00f50a6219d3ddc86f3600a610c00)
Reviewed: https:/ /review. openstack. org/485263 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=dc85c089702 a9819fdab7c951d 427de838a3dcc6
Committed: https:/
Submitter: Jenkins
Branch: stable/ocata
commit dc85c089702a981 9fdab7c951d427d e838a3dcc6
Author: Chris Dent <email address hidden>
Date: Sat Jul 15 18:49:57 2017 +0100
[placement] fix 500 error when allocating to bad class
Adjust exception handling when calling set_allocations so that a
KeyError in the usage_map raises an InvalidInventory. When making
allocations against a resource provider with >1 resource classes
and where one of those resource classes does not have inventory on the
provider, we can attempt to get info out of the usage_map that is not
there, and get a KeyError. This catches the KeyError and turns it into
an InvalidInventory which eventually results in a 409 response,
consistent with other responses to bad allocations. Since this is fixing
a 500, no microversion required.
NOTE(mriedem): The functional test required some tweaks for Ocata since
we didn't have the 1.7 microversion in Ocata. In addition, inventories
in early days required that max_unit be set, otherwise it would default
to 0 and no allocations could be made. We might wish to consider that a
bug in older versions that we should fix?
Change-Id: I52fa02b56f8e62 dfa206a3969a99f ab250508760 0a6219d3ddc86f3 600a610c00)
Closes-Bug: #1704574
(cherry picked from commit 913149249cc00f5