Comment 7 for bug 2037107

Revision history for this message
Rodolfo Alonso (rodolfo-alonso-hernandez) wrote :

Hello:

The issue with the subnet network RBACs is, precisely, that the RBAC register don't belong to the resource itself, these are parent resource RBACs. The GROUP BY clauses introduced and the lazy="joined" strategy work for any parent resource having these RBACs associated registers.

In the case of the subnet we have the following issues:
* The RBACs don't have direct match with the resource but through the subnet network ID.
* In the IPAM module we are manually creating the SQL query, adding Subnet, SubnetServiceType and other resources (as RBACs) to this query. The GROUP BY clause is not applied here.
* If we move the loading method to lazy="subquery", the GROUP BY clause won't apply when using the OVO to retrieve the resources. For example the "get_subnets" query will return a non-optimized SQL query.

The solution here could be to modify the Subnet model and instead of adding "rbac_entries" to the model view, adding the network view instead, using lazy='subquery' loading strategy. The model query does retrieve the RBAC entries in an optimized way and then inherit the Network.shared.

Regards.