← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1708260] Re: Sending empty allocations list on a PUT /allocations/{consumer_uuid} results in 500

 

Reviewed:  https://review.openstack.org/490195
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=9155da345e5d6d1aee293bc66f746da52bca4c79
Submitter: Jenkins
Branch:    master

commit 9155da345e5d6d1aee293bc66f746da52bca4c79
Author: Chris Dent <cdent@xxxxxxxxxxxxx>
Date:   Wed Aug 2 21:21:12 2017 +0100

    [placement] Require at least one allocation when PUT
    
    When doing a PUT to /allocations/{consumer_uuid} if the list of
    allocations is empty there is a 500 error coming from an uncaught
    IndexError.
    
    Adjust the schema to require at least one allocation. If no allocations
    are provided in the list, the response will be a 400.
    
    This doesn't require a microversion because it is changing a 500 to
    a useful response.
    
    Change-Id: I361fa1e534d7b20c985558e272b672b84c6fe439
    Closes-Bug: #1708260


** Changed in: nova
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1708260

Title:
  Sending empty allocations list on a PUT /allocations/{consumer_uuid}
  results in 500

Status in OpenStack Compute (nova):
  Fix Released
Status in OpenStack Compute (nova) ocata series:
  Confirmed

Bug description:
  If you send an empty allocation list to the placement server:

  - name: put an allocation empty list
    PUT: /allocations/599ffd2d-526a-4b2e-8683-f13ad25f9958
    request_headers:
        content-type: application/json
    data:
        allocations: []

  You'll get a 500 response because of an Index error when consumer_id =
  allocs[0].consumer_id.

  Instead we should never reach this code. There should either be a
  schema violation, because we should have at least one allocation, or
  if we're willing to accept an empty list and do nothing, w should skip
  the call to the database.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1708260/+subscriptions


References