get_group_project_roles() asks same ldap query for all groups associated with user

Bug #1205506 reported by alexius ludeman
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
Medium
Morgan Fainberg

Bug Description

in assignment/core.py:_get_group_project_roles() iterators over all my ldap user groups and calls self._get_metadata(group_id=x['id'], tenant_id=project_ref['id'])

in assignment/backends/ldap.py:_get_metadata() has a parameter group_id but it not used in the function.

this effectively calls ldap for every group with the identical question:
    2013-07-26 21:50:32,026 (keystone.common.ldap.core): DEBUG core search_s LDAP search: dn=cn=groups,dc=bogus,dc=com, scope=1, query=(&(cn=OS_TENANT_NAME)(objectClass=posixGroup)), attrs=['enabled', 'cn', 'businessCategory', 'description']

where OS_TENANT_NAME is shell environment variable.

summary: - _get_group_project_roles() doesn't do anything
+ get_group_project_roles() asks same ldap query for all groups associated
+ with user
Adam Young (ayoung)
Changed in keystone:
assignee: nobody → Adam Young (ayoung)
Revision history for this message
Dolph Mathews (dolph) wrote :

I assume the same can be accomplished in a single query to LDAP?

Adam- I believe I saw a patch in review for this... if that's the case, is the commit message missing this bug number?

Changed in keystone:
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Dolph Mathews (dolph) wrote :

Unassigning due to inactivity.

Changed in keystone:
assignee: Adam Young (ayoung) → nobody
Changed in keystone:
assignee: nobody → Pablo Fernando Cargnelutti (pablo-fernando-cargnelutti)
Revision history for this message
Pablo Fernando Cargnelutti (pablo-fernando-cargnelutti) wrote :

Just for my clarification. The idea would be to override get_roles_for_user_and_projects in ldap driver so we can do a the roles gattering using a single LDAP query?

Revision history for this message
Dolph Mathews (dolph) wrote :

Sort of - get_roles_for_user_and_project(user_id, tenant_id) is a manager method, not a driver method. But loops over the results of a driver call to list_groups_for_user() because the driver method it really needs doesn't actually exist (something to provide _get_group_project_roles() in a single driver call). So, the for loop could be factored out into the base driver class as a *new* method, and then the LDAP, SQL and KVS implementations could override it with much more efficient methods.

tags: added: performance
tags: added: ldap sql
Revision history for this message
Pablo Fernando Cargnelutti (pablo-fernando-cargnelutti) wrote :

Clear, thanks for the response.

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/86025

Changed in keystone:
status: Triaged → In Progress
Changed in keystone:
assignee: Pablo Fernando Cargnelutti (pablo-fernando-cargnelutti) → Morgan Fainberg (mdrnstm)
Changed in keystone:
status: In Progress → Fix Committed
Changed in keystone:
milestone: none → juno-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in keystone:
milestone: juno-2 → 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.