Comment 1 for bug 1830630

Revision history for this message
Keyang Li (ilkykli) wrote :

the DB sql:
----------------------------------------
SELECT networkrbacs.tenant_id AS networkrbacs_tenant_id, networkrbacs.id AS networkrbacs_id, networkrbacs.target_tenant AS networkrbacs_target_tenant, networkrbacs.action AS networkrbacs_action, networkrbacs.object_id AS networkrbacs_object_id, subnets_1.network_id AS subnets_1_network_id
        FROM (
  SELECT DISTINCT networks.id AS networks_id
        FROM networks
  LEFT OUTER JOIN networkrbacs ON networks.id = networkrbacs.object_id
  LEFT OUTER JOIN externalnetworks ON networks.id = externalnetworks.network_id
  LEFT OUTER JOIN ml2_network_segments ON networks.id = ml2_network_segments.network_id
  JOIN standardattributes ON standardattributes.id = networks.standard_attr_id
        WHERE ml2_network_segments.is_dynamic IS false AND (networks.tenant_id = 'fd27c1f66a5d4f888672a18b1b0c95b6' OR networkrbacs.action = 'access_as_shared' AND (networkrbacs.target_tenant = 'fd27c1f66a5d4f888672a18b1b0c95b6' OR networkrbacs.target_tenant = '*')) AND networks.name IN ('cmnet01_net0116') AND externalnetworks.network_id IS NOT NULL) AS anon_1
  JOIN subnets AS subnets_1 ON anon_1.networks_id = subnets_1.network_id
  JOIN networkrbacs ON subnets_1.network_id = networkrbacs.object_id
  ORDER BY subnets_1.network_id
--------------------------------------------------------------------

In fact,there is no need to join rbac after join subnet when get network.
because before join subnet it process the rbac here:https://github.com/openstack/neutron-lib/blob/master/neutron_lib/db/model_query.py#L121