/v2.0/tenants: the 'limit' paramter should limit results instead of scopes

Bug #1006055 reported by Ding Deng
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
Medium
Dolph Mathews

Bug Description

When the optional 'marker' and 'limit' parameters are both specified, 'limit' is applied before 'marker'.

GET /v2.0/tenants:

{
  "tenants_links": [],
  "tenants": [
    { "enabled": true, "description": null, "name": "tenant1", "id": "81f502a8e4204ac7802b0b2273727049" },
    { "enabled": true, "description": null, "name": "tenant2", "id": "90fb2d6420144a258ad07bd23035b17c" },
    { "enabled": true, "description": null, "name": "tenant3", "id": "95e384faee5f488e9ddadd75b94bf0af" },
    { "enabled": true, "description": null, "name": "tenant4", "id": "144e098b71de431e81ec16e2c1ee31fc" },
  ]
}

GET /v2.0/tenants?marker=81f502a8e4204ac7802b0b2273727049&limit=2:

{
  "tenants_links": [],
  "tenants": [
    { "enabled": true, "description": null, "name": "tenant2", "id": "90fb2d6420144a258ad07bd23035b17c" }
  ]
}

What we expect:

{
  "tenants_links": [],
  "tenants": [
    { "enabled": true, "description": null, "name": "tenant2", "id": "90fb2d6420144a258ad07bd23035b17c" },
    { "enabled": true, "description": null, "name": "tenant3", "id": "95e384faee5f488e9ddadd75b94bf0af" },
  ]
}

Reproducible: always.
Version: 2012.1.

Changed in keystone:
assignee: nobody → Dolph Mathews (dolph)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (master)

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

Revision history for this message
Dolph Mathews (dolph) wrote :

The calculation for the last item to be returned only worked as expected when there was no marker provided.

After applying the above proposed fix:

GET /tenants: http://paste.openstack.org/raw/18292/

GET /tenants with marker & limit applied: http://paste.openstack.org/raw/18293/

Dolph Mathews (dolph)
Changed in keystone:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (master)

Reviewed: https://review.openstack.org/6875
Committed: http://github.com/openstack/keystone/commit/23ca656927947dada40591bdd1badd5a531c2983
Submitter: Jenkins
Branch: master

commit 23ca656927947dada40591bdd1badd5a531c2983
Author: Dolph Mathews <email address hidden>
Date: Wed Mar 28 10:37:16 2012 -0700

    Refactor 404's into managers & drivers (bug 968519)

    The goal is to move the responsibility of reference checks away from
    controllers and into the underlying managers & drivers, which can
    handle the task with equal or greater efficiency.

    - Tenant references from create_user/update_user are NOT tested
      due to inconsistencies between backends
    - Additional test coverage improvements

    Also fixes bug 999209, bug 999608, bug 1006029, bug 1006055, bug 1006287,
    bug 1006334, and bug 1006344.

    Change-Id: I7de592e7dd4518038436b9a9fdaab559b00a0537

Changed in keystone:
status: In Progress → Fix Committed
Changed in keystone:
status: Fix Committed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/8036
Committed: http://github.com/openstack/keystone/commit/002dd429532721392b0676eb42ec1bfb5735c0ea
Submitter: Jenkins
Branch: master

commit 002dd429532721392b0676eb42ec1bfb5735c0ea
Author: Dolph Mathews <email address hidden>
Date: Fri Jun 1 09:35:41 2012 -0500

    Fixed marker & limit computation (bug 1006055)

    Change-Id: I8a4a7b114b05e36024753cd02189188fd4294fc1

Changed in keystone:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in keystone:
milestone: none → folsom-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in keystone:
milestone: folsom-3 → 2012.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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