Bug 1299980 - [RFE] Pagination and Filtering For Listing OpenStack Server Groups Using REST API
Summary: [RFE] Pagination and Filtering For Listing OpenStack Server Groups Using REST...
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-nova
Version: 7.0 (Kilo)
Hardware: All
OS: Linux
medium
medium
Target Milestone: ga
: 11.0 (Ocata)
Assignee: Eoghan Glynn
QA Contact: nlevinki
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-01-19 16:25 UTC by Jack Waterworth
Modified: 2019-12-16 05:18 UTC (History)
13 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-22 13:57:07 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
OpenStack gerrit 400851 0 None MERGED api-ref: add missing os-server-groups parameters 2020-04-22 21:28:11 UTC
Red Hat Knowledge Base (Solution) 1562523 0 None None None 2016-03-08 19:06:12 UTC

Comment 2 Jack Waterworth 2016-01-19 16:26:49 UTC
The issue isn't with the limit itself.  The issue is that regardless of what that limit is, if we have more entries than that number allows, we can't get all the results.

So, for example, say we have a limit of 500.  We do a RESP API call to retrieve a list of server groups so that we can run some logic with it.  If there are 750 entries, we only get 500 of those.  We could increase the limit to 1000, but that will only work as long as the number of server groups is below 1000.  If the number of server groups increases from 750 to 1500, we run across the same problem again.

Changing the limit is often times undesirable, because it changes the number of results returned for all queries, not just for server groups.

Filtering within the REST API would be a useful feature as well, since even with the case of pagination, there might be more information than we want to have to page through.

I attempted adding the url parameters in the format "http://<server>/v2/<tenant_id>/os-server-groups?limit=10&marker=<server_group_id>" .  The limit parameter appears to work, but not marker, so it doesn't appear that pagination is available.

Comment 7 Diana Clarke 2016-11-21 21:33:04 UTC
The 'os-server-groups' endpoint uses 'limit' & 'offset' query parameters, not 'limit' & 'marker' query parameters.

For example, testing notes on devstack:

    http://paste.openstack.org/show/589962/

Can you give 'offset' a try and let me know if that doesn't work?

Comment 8 Diana Clarke 2016-11-22 13:57:07 UTC
Marking this as closed since 'os-server-groups' paging has worked for a few years now (I'm not sure when it was first introduced).

I've added it to my TODO list to update the api-ref docs [1] to include the optional 'limit' and 'offset' query parameters.

This is the code [2] 'os-server-groups' is using to facilitate paging.

From that code: 'offset' is where to start in the list, and 'limit' is the maximum number of items to return. If 'limit' is not specified, 0, or > max_limit, we default to max_limit.

[1] http://developer.openstack.org/api-ref/compute/?expanded=list-server-groups-detail

[2] https://github.com/openstack/nova/blob/47ff843551cdaf5935ddf74647a1b81153975b21/nova/api/openstack/common.py#L217

Hope that helps, Cheers!


Note You need to log in before you can comment on or make changes to this bug.