Fix nits in resource_provider.py

1. Change the comments on forbidden trait
2. We already change _get_provider_ids_matching result from "provider
IDs" to "tuples of (internal provider ID, root provider ID)" in the
I343a0cb19f4037ddde5c5fc96d0a053f699f5257
3. Remove out-of-date comments about "handling nested providers" from
039c94a6b9

trivialfix

Change-Id: I7b23ef4c06be8963e43e0c23ac6cc149ffd2ddae
This commit is contained in:
Yikun Jiang 2018-08-03 16:26:06 +08:00
parent 04afe2aae9
commit 8f3268dd7c
1 changed files with 6 additions and 9 deletions

View File

@ -2822,7 +2822,7 @@ def _get_provider_ids_matching(ctx, resources, required_traits,
# First filter by the resource providers that had all the required traits
if trait_rps:
where_conds.append(rpt.c.id.in_(trait_rps))
# or have any forbidden trait
# and didn't have any forbidden traits
if forbidden_rp_ids:
where_conds.append(~rpt.c.id.in_(forbidden_rp_ids))
@ -3966,16 +3966,13 @@ class AllocationCandidates(base.VersionedObject):
# Either we are processing a single-RP request group, or there are no
# sharing providers that (help) satisfy the request. Get a list of
# resource provider IDs that have ALL the requested resources and more
# efficiently construct the allocation requests.
# NOTE(jaypipes): When we start handling nested providers, we may
# add new code paths or modify this code path to return root
# provider IDs of provider trees instead of the resource provider
# IDs.
rp_ids = _get_provider_ids_matching(context, resources,
# tuples of (internal provider ID, root provider ID) that have ALL
# the requested resources and more efficiently construct the
# allocation requests.
rp_tuples = _get_provider_ids_matching(context, resources,
required_trait_map,
forbidden_trait_map, member_of)
return _alloc_candidates_single_provider(context, resources, rp_ids)
return _alloc_candidates_single_provider(context, resources, rp_tuples)
@classmethod
# TODO(efried): This is only a writer context because it accesses the