API doesn't specify what limit=0 means

Bug #794730 reported by Brian Waldon
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Opinion
Wishlist
Unassigned

Bug Description

An http request like /v1.1/images?limit=0 returns all images available. It should return an empty container.

Tags: compute-api
Alex Meade (alex-meade)
Changed in nova:
assignee: nobody → Alex Meade (alex-meade)
status: New → In Progress
Revision history for this message
Brian Waldon (bcwaldon) wrote :

Same goes for /servers

Revision history for this message
Alex Meade (alex-meade) wrote :

The comments in the code specify that if a limit=0 is given then limit will be set to the max limit. I am going to hold off until the intention is clarified or we decide to change it to return no results.

Revision history for this message
Thierry Carrez (ttx) wrote :

Looks like it's by design ?

Changed in nova:
status: In Progress → Incomplete
Revision history for this message
Alex Meade (alex-meade) wrote :

I've looked over the spec and it doesn't mention anything about a zero limit. I think we should either leave it the way it is or change a limit of zero to return empty results. Either way it should be mentioned in the spec.

Let me know what you guys think

Thierry Carrez (ttx)
affects: nova → openstack-manuals
summary: - OSAPI images limit query param incorrectly handles zero
+ API doesn't specify what limit=0 means
Changed in openstack-manuals:
status: Incomplete → Confirmed
Anne Gentle (annegentle)
tags: added: compute-api
Revision history for this message
Tom Fifield (fifieldt) wrote :

The behaviour looks unchanged for ~10 months now.

Perhaps this can be counted as a vote for "leave it as limit=0 means no limit", and we can close this bug now?

Revision history for this message
Brian Waldon (bcwaldon) wrote :

It makes more sense to interpret the integer literally.

Revision history for this message
Tom Fifield (fifieldt) wrote :

Added it to the nova bugtracker to start the discussion there for the functionality change

Tom Fifield (fifieldt)
Changed in openstack-manuals:
importance: Undecided → Low
Revision history for this message
Ying Chun Guo (daisy-ycguo) wrote :

Simply speaking, if a parameter is invalid, an error message should be returned; if the parameter can be accepted, interpret it literally.

So if the back end service can accept parameter "limit = 0", I prefer returning empty result.

Tom Fifield (fifieldt)
no longer affects: openstack-manuals
Tom Fifield (fifieldt)
Changed in nova:
status: New → Confirmed
Thierry Carrez (ttx)
Changed in nova:
importance: Undecided → Wishlist
Revision history for this message
lizheming (lizheming-li) wrote :

I agree Ying Chun Guo.
for most user, they will think that "limit=0" return empty result
but max result. this is normal if you have not pointed out.

Changed in nova:
assignee: nobody → lizheming (lizheming-li)
lizheming (lizheming-li)
Changed in nova:
assignee: lizheming (lizheming-li) → nobody
Revision history for this message
Sean Dague (sdague) wrote :

It looks like limit 0 is largely implemented as empty list now

Changed in nova:
status: Confirmed → Invalid
Revision history for this message
Mark Doffman (mjdoffma) wrote :

Sorry to try and bring this one back to life, but i'm just not sure that its really invalid. Marked https://bugs.launchpad.net/nova/+bug/1494617 as duplicate.

Seems that for the images api this now implements the empty list . However I think that for flavors and servers api Ithat the behavior is still to use limit=0 as max_limit. These should one day be consistent?

At the very least we should change the comments in http://git.openstack.org/cgit/openstack/nova/tree/nova/api/openstack/common.py#n206 to represent the new behavior.

Changed in nova:
status: Invalid → Confirmed
Changed in nova:
assignee: nobody → Zhenyu Zheng (zhengzhenyu)
Revision history for this message
John Garbutt (johngarbutt) wrote :

the images API is a proxy to glance, so generally we let glance set the limits on that API.

Revision history for this message
Sean Dague (sdague) wrote :

Making the proxies consistent with our usage is a bit beyond scope. I think this is a wishlist item which if someone ever wants to do, is fine, but I don't think we want an open artifact here.

Changed in nova:
status: Confirmed → Opinion
assignee: Zhenyu Zheng (zhengzhenyu) → nobody
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.