[openstack-dev] [nova] [api] Nova currently handles list with limit=0 quite different for different objects.
Kevin L. Mitchell
kevin.mitchell at rackspace.com
Fri Sep 11 16:07:35 UTC 2015
On Fri, 2015-09-11 at 15:41 +0800, Zhenyu Zheng wrote:
> Hi, I found out that nova currently handles list with limit=0 quite
> different for different objects.
>
> Especially when list servers:
>
> According to the code:
> http://git.openstack.org/cgit/openstack/nova/tree/nova/api/openstack/common.py#n206
>
> when limit = 0, it should apply as max_limit, but currently, in:
> http://git.openstack.org/cgit/openstack/nova/tree/nova/db/sqlalchemy/api.py#n1930
>
> we directly return [], this is quite different with comment in the api
> code.
>
>
> I checked other objects:
>
> when list security groups and server groups, it will return as no
> limit has been set. And for flavors it returns []. I will continue to
> try out other APIs if needed.
>
> I think maybe we should make a rule for all objects, at least fix the
> servers to make it same in api and db code.
>
> I have reported a bug in launchpad:
>
> https://bugs.launchpad.net/nova/+bug/1494617
>
>
> Any suggestions?
After seeing the test failures that showed up on your proposed fix, I'm
thinking that the proposed change reads like an API change, requiring a
microversion bump. That said, I approve of increased consistency across
the API, and perhaps the behavior on limit=0 is something the API group
needs to discuss a guideline for?
--
Kevin L. Mitchell <kevin.mitchell at rackspace.com>
Rackspace
More information about the OpenStack-dev
mailing list