Remove redundant `where` for forbidden traits
Following on from [1], we don't need to add a `where` clause for forbidden traits if we already added one for filtered-down providers, because the method that gives us the filtered-down providers already excludes providers with forbidden traits. [1] https://review.openstack.org/#/c/602740/2/placement/objects/resource_provider.py@1446 Change-Id: Id92367b83aae2187d016e2ae3f08401827785cd4
This commit is contained in:
parent
8ef157e083
commit
ebb9f1e346
|
@ -1443,7 +1443,10 @@ class ResourceProviderList(base.ObjectListBase, base.VersionedObject):
|
|||
return []
|
||||
if rp_ids:
|
||||
query = query.where(rp.c.id.in_(rp_ids))
|
||||
if forbidden_rp_ids:
|
||||
# forbidden providers, if found, are mutually exclusive with matching
|
||||
# providers above, so we only need to include this clause if we didn't
|
||||
# use the positive filter above.
|
||||
elif forbidden_rp_ids:
|
||||
query = query.where(~rp.c.id.in_(forbidden_rp_ids))
|
||||
|
||||
if not resources:
|
||||
|
|
Loading…
Reference in New Issue