GET volumes REST API does not handle limit of 0

Bug #1289124 reported by Steven Kaufer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
High
Steven Kaufer

Bug Description

This bug is a regression caused by https://bugs.launchpad.net/cinder/+bug/1288429

This fix merged by bug 1288429 failed to check if the limit was 0 and, if specified, then an exception is thrown:

     File "/opt/stack/cinder/cinder/api/common.py", line 262, in _get_collection_links
        last_item = items[-1]
   IndexError: list index out of range

This fix will this handle a limit of 0 and create test code to verify this path.

Steven Kaufer (kaufer)
Changed in cinder:
assignee: nobody → Steven Kaufer (kaufer)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.openstack.org/78856

Changed in cinder:
status: New → In Progress
Jay Bryant (jsbryant)
Changed in cinder:
importance: Undecided → High
milestone: none → icehouse-rc1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/78856
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=5cee4f41078ff692a37bb4c553f8faa68c782253
Submitter: Jenkins
Branch: master

commit 5cee4f41078ff692a37bb4c553f8faa68c782253
Author: Steven Kaufer <email address hidden>
Date: Fri Mar 7 04:54:50 2014 +0000

    get volumes API does not handle limit=0

    This bug fixes a regression from bug 1288429, where the "next"
    link is added when the number of volumes returned is the
    maximum limit (even if the "limit" param is not specified).

    The regression is hit when a "limit" of 0 is specified; in this
    case the logic to create the "next" link is still executed and an
    exception is thrown. The fix is to add back in the "if" check that
    implictly checks if the max_items is non-0.

    Test code was also created to verify that a limit of 0 is handled
    correctly.

    Change-Id: I92f9afb9b0e2c627d2c77f67fa026b731903384f
    Closes-bug: 1289124

Changed in cinder:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in cinder:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in cinder:
milestone: icehouse-rc1 → 2014.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.