Filtering services by name doesn't work

Bug #1350273 reported by Juan Antonio Osorio Robles
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
Wishlist
Juan Antonio Osorio Robles

Bug Description

doing a query for listing services filtering by name doesn't work in the SQL backend. This is due to a couple of things:

* 'name' doesn't appear in the filterprotected decorator in keystone.catalog.controllers line 250 (https://github.com/openstack/keystone/blob/d9bfb7a695b3f886dbb961e721bce91194e14cce/keystone/catalog/controllers.py#L250)

* the sql model for the service doesn't have an explicit name attribute in keystone.catalog.backends.sql

This is an issue since some clients (namely python-openstackclient) give the option to create endpoints
with the service name as a parameter (you can give the service id, name or type), even though it is not
possible to retrieve a service from keystone using the name.

Revision history for this message
Juan Antonio Osorio Robles (juan-osorio-robles) wrote :

So I would like to know, should I add name as an sql column in the backend to enable this filtering?
Or should filtering by name not be possible and thus, should I then fix it in the python-openstackclient?

Changed in keystone:
assignee: nobody → Juan Antonio Osorio Robles (juan-osorio-robles)
description: updated
Revision history for this message
Lance Bragstad (lbragstad) wrote :

It looks like the `name` attribute of a service is stored in the `extra` field of the SQL backend:

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

It looks like the`service` table is never created with a name column:

https://github.com/openstack/keystone/blob/d9bfb7a695b3f886dbb961e721bce91194e14cce/keystone/common/sql/migrate_repo/versions/036_havana.py#L125-L131

One way to fix this would be to add a migration, but the information you need is in the `extra` column of the service table. Until it's decided if a migration is needed or not, maybe find a way to pull the data out of `extra` and filter accordingly?

Revision history for this message
Lance Bragstad (lbragstad) wrote :
Revision history for this message
Henry Nash (henry-nash) wrote :

So we don't need to actually create the 'name' field in the SQL to implement filtering by 'name', since the SQL backend is not required to be able to satisfy all the filters - its on a best efforts basis. Any filters it fails to satisfy, will be satisfied in the controller wrapper. This is obviously less efficient, since it is being done in python code instead of using the DB query code, but should still work if we think this filter is infrequently used.

What we MAY need to do in order to just do this at the controller level is fix the TODO I wrote in common/sql/core.py to say that we should check whether the filter exists as a valid column and if it does not, then ignore that filter (and leave it for the controller to carry out when the response is passed back to it)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (master)

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

Changed in keystone:
status: New → In Progress
Revision history for this message
Dolph Mathews (dolph) wrote :
Changed in keystone:
importance: Undecided → Wishlist
Changed in keystone:
assignee: Juan Antonio Osorio Robles (juan-osorio-robles) → Dolph Mathews (dolph)
Dolph Mathews (dolph)
Changed in keystone:
assignee: Dolph Mathews (dolph) → Juan Antonio Osorio Robles (juan-osorio-robles)
tags: added: meeting-topic
Revision history for this message
Lance Bragstad (lbragstad) wrote :

This was discussed in the Keystone meeting and we've decided to move forward with the proposed review and include this in Juno RC1.

Changed in keystone:
milestone: none → juno-rc1
tags: removed: meeting-topic
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (master)

Reviewed: https://review.openstack.org/110904
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=27f4380fb1bd87154f5b7958c69846545b81ce97
Submitter: Jenkins
Branch: master

commit 27f4380fb1bd87154f5b7958c69846545b81ce97
Author: Juan Antonio Osorio <email address hidden>
Date: Thu Jul 31 13:30:32 2014 +0300

    Enable filtering of services by name

    This commit enables the filtering of services through the service's
    name. This wasn't available before, since the name is not saved in the
    backend as a column, but instead it's stored as an extra attribute.

    Thus, this commits enables this type of search by asserting a TODO that
    was left in the SQL backend, and also adding the `name` attribute to the
    filterprotected decorator.

    This is needed since some clients (namely python-openstackclient) assume
    that this functionality already exists and thus give the option to
    create endpoints with the service name as a parameter.

    Change-Id: Ifc9c1e44e908410740f6f20380b264d35096fcac
    Closes-Bug: #1350273

Changed in keystone:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in keystone:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in keystone:
milestone: juno-rc1 → 2014.2
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.