summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBalazs Gibizer <gibi@redhat.com>2022-12-16 16:21:17 +0100
committerBalazs Gibizer <gibi@redhat.com>2023-01-05 17:40:17 +0100
commitf41226206c002fd5a858a256ae064fc64d127f2c (patch)
treea24dd8e99761ee1aa930987a5304ffa8289a51ba
parentd53a4922a0eea40f5dd5911af751976d83ff915b (diff)
downloadnova-f41226206c002fd5a858a256ae064fc64d127f2c.tar.gz
Split ignored_tags in stats.py
As a follow up for https://review.opendev.org/c/openstack/nova/+/854121/14/nova/pci/stats.py#75 this patch split the ignored_tags to two list, ignored_pool_tags and ignored_spec_tags as the two tag list are different. Change-Id: I735792ab285ad42e622e9a71e2a533f821316854
-rw-r--r--nova/pci/stats.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/nova/pci/stats.py b/nova/pci/stats.py
index b7b79661be..5c5f7c669c 100644
--- a/nova/pci/stats.py
+++ b/nova/pci/stats.py
@@ -68,11 +68,15 @@ class PciDeviceStats(object):
# the PCI alias, but they are matched by the placement
# allocation_candidates query, so we can ignore them during pool creation
# and during filtering here
- ignored_tags = ['resource_class', 'traits']
- # these are metadata keys in the pool and in the request that are matched
+ ignored_spec_tags = ignored_pool_tags = ['resource_class', 'traits']
+ # this is a metadata key in the spec that is matched
# specially in _filter_pools_based_on_placement_allocation. So we can
# ignore them in the general matching logic.
- ignored_tags += ['rp_uuid', 'rp_uuids']
+ ignored_spec_tags += ['rp_uuids']
+ # this is a metadata key in the pool that is matched
+ # specially in _filter_pools_based_on_placement_allocation. So we can
+ # ignore them in the general matching logic.
+ ignored_pool_tags += ['rp_uuid']
def __init__(
self,
@@ -146,7 +150,11 @@ class PciDeviceStats(object):
if tags:
pool.update(
- {k: v for k, v in tags.items() if k not in self.ignored_tags}
+ {
+ k: v
+ for k, v in tags.items()
+ if k not in self.ignored_pool_tags
+ }
)
# NOTE(gibi): since PCI in placement maps a PCI dev or a PF to a
# single RP and the scheduler allocates from a specific RP we need
@@ -358,7 +366,9 @@ class PciDeviceStats(object):
def ignore_keys(spec):
return {
- k: v for k, v in spec.items() if k not in self.ignored_tags
+ k: v
+ for k, v in spec.items()
+ if k not in self.ignored_spec_tags
}
request_specs = [ignore_keys(spec) for spec in request.spec]