Comment 5 for bug 1704574

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/ocata)

Reviewed: https://review.openstack.org/485263
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=dc85c089702a9819fdab7c951d427de838a3dcc6
Submitter: Jenkins
Branch: stable/ocata

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)