Cinder API v2: List Snapshots Details can not use search options like "offset" and "limit" as admin user

Bug #1205956 reported by wanghao
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Low
Xiaoxi Chen
Grizzly
Fix Released
Low
wanghao

Bug Description

hi, all:

when list snapshot details in cinder by using admin user, the "limit" or "offset" search options do not work. my request url like

this : "http://192.168.82.230:8776/v2/dc4059e8e7994f2498b514ca04cdaf44/snapshots/detail?limit=1",but it worked by using common user.

I think there is something wrong in process of listing snapshot details.

wanghao (wanghao749)
Changed in cinder:
assignee: nobody → wanghao (wanghao749)
Revision history for this message
Xiaoxi Chen (xiaoxi-chen) wrote :

This is simply because in api/v2/snapshots.py, it doesn't pop out limit and offset from GET param before use it as filter
refer to:
https://github.com/openstack/cinder/blob/master/cinder/api/v2/snapshots.py#L143

Changed in cinder:
status: New → Confirmed
assignee: wanghao (wanghao749) → xiaoxi_chen (xiaoxi-chen)
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/39026

Changed in cinder:
status: Confirmed → In Progress
description: updated
summary: - Cinder:List Snapshot Details can not use search options like "offset"
- and "limit" by using admin user
+ List Volumes/Snapshots Details can not use search options like "offset"
+ and "limit" as admin user
summary: - List Volumes/Snapshots Details can not use search options like "offset"
- and "limit" as admin user
+ Cinder API v2: List Snapshots Details can not use search options like
+ "offset" and "limit" as admin user
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/39026
Committed: http://github.com/openstack/cinder/commit/08af981ffc104d7cb836c1b674e1d73724eeaf88
Submitter: Jenkins
Branch: master

commit 08af981ffc104d7cb836c1b674e1d73724eeaf88
Author: xiaoxi_chen <email address hidden>
Date: Mon Jul 29 14:21:25 2013 +0800

    Pop out 'offset' and 'limit' before use for filter

    In previous code of _items() from api/v{1,2}/snapshots.py,
    and also the _items)_ from api/v1/volume.py.we didn't pop
    out the 'offset' and 'limit' fields from HTTP get params
    before we use such params for filter.This is the root cause
    for bug #1205956

    For non-admin user, since 'offset' and 'limit' is not in the
    allowed_search_options, so the volumes.remove_invalid_options
    will help to filter them out. As a result, it walks around this
    bug.

    But for admin user,the volumes.remove_invalid_options will not
    try to filter the search_options.So for admin user, the 'limit'
    will appear in search_options, then obviously get no result.

    fixed bug #1205956

    Change-Id: Ib1a66c9d104ac52d6eae18be7f06d02985d4c2fd

Changed in cinder:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in cinder:
milestone: none → havana-3
status: Fix Committed → Fix Released
wanghao (wanghao749)
tags: added: grizzly-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (stable/grizzly)

Fix proposed to branch: stable/grizzly
Review: https://review.openstack.org/48556

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

Reviewed: https://review.openstack.org/48556
Committed: http://github.com/openstack/cinder/commit/9e94ef8422ea13763d3c6ce9f34a96ccff56796d
Submitter: Jenkins
Branch: stable/grizzly

commit 9e94ef8422ea13763d3c6ce9f34a96ccff56796d
Author: xiaoxi_chen <email address hidden>
Date: Mon Jul 29 14:21:25 2013 +0800

    Pop out 'offset' and 'limit' before use for filter

    In previous code of _items() from api/v{1,2}/snapshots.py,
    and also the _items)_ from api/v1/volume.py.we didn't pop
    out the 'offset' and 'limit' fields from HTTP get params
    before we use such params for filter.This is the root cause
    for bug #1205956

    For non-admin user, since 'offset' and 'limit' is not in the
    allowed_search_options, so the volumes.remove_invalid_options
    will help to filter them out. As a result, it walks around this
    bug.

    But for admin user,the volumes.remove_invalid_options will not
    try to filter the search_options.So for admin user, the 'limit'
    will appear in search_options, then obviously get no result.

    fixed bug #1205956

    Change-Id: Ib1a66c9d104ac52d6eae18be7f06d02985d4c2fd
    (cherry picked from commit 08af981ffc104d7cb836c1b674e1d73724eeaf88)

tags: added: in-stable-grizzly
Thierry Carrez (ttx)
Changed in cinder:
milestone: havana-3 → 2013.2
Alan Pevec (apevec)
tags: removed: grizzly-backport-potential in-stable-grizzly
Changed in cinder:
importance: Undecided → Low
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.