UpdateProjectMembersAction is polling all users.

Bug #1224114 reported by Charles V Bock
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Low
Charles V Bock

Bug Description

The Update Project Members Action is polling all users for their roles when it only needs the current tenant's users roles.

Line: 218 openstack_dashboard/dashboards/admin/projects/workflows.py

        # Figure out users & roles
        if project_id:
            for user in all_users:
                try:
                    roles = api.keystone.roles_for_user(self.request,
                                                        user.id,
                                                        project_id)
                except Exception:
                    exceptions.handle(request,
                                      err_msg,
                                      redirect=reverse(INDEX_URL))
                for role in roles:
                    field_name = self.get_member_field_name(role.id)
                    self.fields[field_name].initial.append(user.id)

If there are more than a few users this quickly turns into a horrible slowdown as hundreds or thousands (depending on user count) of calls have to be made to keystone for each users roles.

We could easily replace all_users with project_members like so...

 # Figure out users & roles
        if project_id:
            project_members = api.keystone.user_list(request,
                project=project_id)
            for user in project_members:
                ETC...

I'll propose this change for review.

Changed in horizon:
assignee: nobody → Charles V Bock (charles-v-bock)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

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

Changed in horizon:
status: New → In Progress
Changed in horizon:
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/46161
Committed: http://github.com/openstack/horizon/commit/b3ff541a3a5af3e0ba891c5fa78aac2d7efc29c5
Submitter: Jenkins
Branch: master

commit b3ff541a3a5af3e0ba891c5fa78aac2d7efc29c5
Author: Charles V Bock <email address hidden>
Date: Wed Sep 11 14:47:33 2013 -0700

    Fix UpdateProjectMembersAction excess keystone calls

    Patch adds a single call to keystone user_list with a specified project field
    in place of polling all users roles to find out if they have any roles in the
    current project.

    Change-Id: Ia304af05cdb5be13e67762e0a0a44b17824c30bf
    Fixes: bug #1224114

Changed in horizon:
status: In Progress → Fix Committed
Changed in horizon:
milestone: none → havana-rc1
Thierry Carrez (ttx)
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: havana-rc1 → 2013.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.