Improve list role assignments filtering performance

Registered by Samuel de Medeiros Queiroz

When listing role assignments, we have the option to filter them by actor, target and role.
As Henry Nash pointed out at [1] , the current implementation uses the standard filtering the V3.wrap_collection.
Given the large number of individual assignments, this is pretty inefficient.

The controller should pass the filters into the driver call, so that the list size is kept a minimum.
For example, if the user wants to filter role assignments by project X, the driver would query the DB only selecting the role assignments where target_id = X.id, instead of querying everything and returning the result to be filtered by the controller.

In addition, expansion logic should be placed at Manager level, while Controller is charged of validating the provided filter combinations.

[1] https://github.com/openstack/keystone/blob/498a0032db89997244d3dc7e65ce9b37eac84283/keystone/assignment/controllers.py#L860-L864

Blueprint information

Status:
Complete
Approver:
None
Priority:
High
Drafter:
Samuel de Medeiros Queiroz
Direction:
Approved
Assignee:
Samuel de Medeiros Queiroz
Definition:
Approved
Series goal:
Accepted for liberty
Implementation:
Implemented
Milestone target:
milestone icon 8.0.0
Started by
Morgan Fainberg
Completed by
Morgan Fainberg

Related branches

Sprints

Whiteboard

Decided at the Midcycle that this is Complex enough that it requires a spec.

Gerrit topic: https://review.openstack.org/#q,topic:bp/list-role-assignments-performance,n,z

Addressed by: https://review.openstack.org/148700 (merged)
    Improve list role assignments filters performance

Gerrit topic: https://review.openstack.org/#q,topic:bug/1359231,n,z

Addressed by: https://review.openstack.org/137202 (merged)
    Improve List Role Assignments Filters Performance

Addressed by: https://review.openstack.org/144544 (merged)
    Improve creation of expected assignments in tests

Addressed by: https://review.openstack.org/137021 (merged)
    Improve List Role Assignment Tests

Addressed by: https://review.openstack.org/144702 (merged)
    Refactor check of targets and actors on RoleV3

Addressed by: https://review.openstack.org/144703 (merged)
    Check for invalid filtering on v3/role_assignments

Gerrit topic: https://review.openstack.org/#q,topic:bug/1415268,n,z

Gerrit topic: https://review.openstack.org/#q,topic:bp/data-driven-tests,n,z

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.