Improve AddressScope.get_bound_tenant_ids method

Retrieve only "project_id" from "AddressScope" objects.

Trivial-Fix

Change-Id: Icf74685cbe2cb3ccaea05bc31cacf37c98d5fc04
This commit is contained in:
Rodolfo Alonso Hernandez 2021-04-12 17:49:46 +00:00
parent 51cccd4b1a
commit 960f3694f4
1 changed files with 2 additions and 3 deletions

View File

@ -71,6 +71,5 @@ class AddressScope(rbac_db.NeutronRbacObject):
@classmethod
def get_bound_tenant_ids(cls, context, obj_id):
snp_objs = subnetpool.SubnetPool.get_objects(
context, address_scope_id=obj_id
)
return {snp.project_id for snp in snp_objs}
context, address_scope_id=obj_id, fields=['project_id'])
return {snp['project_id'] for snp in snp_objs}