list_services API filtered by name can't find the service when using list_limit

Bug #1594482 reported by Roxana Gherle on 2016-06-20
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Medium
Roxana Gherle

Bug Description

/services?name=<name> API can't find the service when using list_limit configuration.
Before setting list_limit in keystone.conf the following API call behaves correctly:

stack@mitaka2:/opt/stack/keystone$ curl -H "X-Auth-Token: $TOK" http://mitaka2.com:5000/v3/services?name=keystone | python -mjson.tool
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
100 318 100 318 0 0 95 0 0:00:03 0:00:03 --:--:-- 95
{
    "links": {
        "next": null,
        "previous": null,
        "self": "http://mitaka2.com/identity/v3/services?name=keystone"
    },
    "services": [
        {
            "enabled": true,
            "id": "f7ef63607b8542e0a7cb9a9b1b119c25",
            "links": {
                "self": "http://mitaka2.com/identity/v3/services/f7ef63607b8542e0a7cb9a9b1b119c25"
            },
            "name": "keystone",
            "type": "identity"
        }
    ]
}

After setting list_limit=3 in the Default section in keystone.conf, the API can't find the service any more:

stack@mitaka2:/opt/stack/keystone$ curl -H "X-Auth-Token: $TOK" http://mitaka2.com:5000/v3/services?name=keystone | python -mjson.tool
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
100 143 100 143 0 0 43 0 0:00:03 0:00:03 --:--:-- 43
{
    "links": {
        "next": null,
        "previous": null,
        "self": "http://mitaka2.com/identity/v3/services?name=keystone"
    },
    "services": [],
    "truncated": true
}

It seems like the list is truncated before applying the name filter.

Changed in keystone:
assignee: nobody → Roxana Gherle (roxana-gherle)

Fix proposed to branch: master
Review: https://review.openstack.org/331790

Changed in keystone:
status: New → In Progress
Changed in keystone:
milestone: none → newton-2
importance: Undecided → Medium

Reviewed: https://review.openstack.org/331790
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=6a9a9f002f44c15d40cf890eefd03a4ab6172b0b
Submitter: Jenkins
Branch: master

commit 6a9a9f002f44c15d40cf890eefd03a4ab6172b0b
Author: Roxana Gherle <email address hidden>
Date: Mon Jun 20 10:53:36 2016 -0700

    /services?name=<name> API fails when using list_limit

    When using list_limit configuration option in Default section of
    keystone.conf, the /services?name=<service_name> API fails to find
    the service if list_limit value is smaller than the total number
    of services and the searched service is not among the first
    'list_limit' services. The API should first filter by name and
    only afterwards truncate the result list.

    Also, this patch fixes setting the 'truncated' attribute of the
    driver's hint.limit object when truncating the list outside of
    driver_hints.truncated decorator, problem exposed by fixing the
    problem described in the first paragraph.

    Closes-Bug: #1594482
    Change-Id: I832f542c3cb0faf94a1e5bce5a894f7f4d26a8de

Changed in keystone:
status: In Progress → Fix Released

Change abandoned by Roxana Gherle (<email address hidden>) on branch: stable/liberty
Review: https://review.openstack.org/332975
Reason: not qualifying as a security/critical fix.

This issue was fixed in the openstack/keystone 10.0.0.0b2 development milestone.

This issue was fixed in the openstack/keystone 9.2.0 release.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers