get_pagination_params's behaviour contradicts docstring

Bug #1450167 reported by Artom Lifshitz
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
In Progress
Medium
Artom Lifshitz

Bug Description

get_pagination_params's [1] docstring states that "If 'limit' is not specified, 0, or > max_limit, we default to max_limit." In practice, the code only sets params['limit'] if 'limit' is present in the GET request. It appears as though get_pagination_params should be a private method, and get_limit_and_marker [2] should be used instead.

An effect of this mixup can be observed by setting osapi_max_limit to 1 and listing images and flavors.

Images calls get_pagination_params directly [3]. The call ignores osapi_max_limit=1 and returns all the images [attachment].

Flavors calls get_limit_and_marker [4]. The call correctly returns a single flavor with a link to the following one [attachment].

[1] https://github.com/openstack/nova/blob/master/nova/api/openstack/common.py#L196
[2] https://github.com/openstack/nova/blob/master/nova/api/openstack/common.py#L273
[3] https://github.com/openstack/nova/blob/master/nova/api/openstack/compute/images.py#L119
[4] https://github.com/openstack/nova/blob/master/nova/api/openstack/compute/plugins/v3/flavors.py#L81

Tags: api
Revision history for this message
Artom Lifshitz (notartom) wrote :
Changed in nova:
assignee: nobody → Artom Lifshitz (notartom)
Changed in nova:
status: New → In Progress
Revision history for this message
John Garbutt (johngarbutt) wrote :
tags: added: api
Changed in nova:
importance: Undecided → Medium
Revision history for this message
John Garbutt (johngarbutt) wrote :

This is a bit back to front I think, we could consider ensuring the nova images API respects osapi_max_limit, but we should not be updating the API to match a doc string.

Revision history for this message
Artom Lifshitz (notartom) wrote :

I admit I wrote the bug report backwards - it came about as I was working on other stuff, so in my mind it was structured as code first, behaviour after. I'm going to submit a duplicate report (in order to avoid cluttering this one) with a proper "this is the behaviour that's wrong" description.

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.