Skip to content

Commit f412262

Browse files
committed
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
1 parent d53a492 commit f412262

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

nova/pci/stats.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,15 @@ class PciDeviceStats(object):
6868
# the PCI alias, but they are matched by the placement
6969
# allocation_candidates query, so we can ignore them during pool creation
7070
# and during filtering here
71-
ignored_tags = ['resource_class', 'traits']
72-
# these are metadata keys in the pool and in the request that are matched
71+
ignored_spec_tags = ignored_pool_tags = ['resource_class', 'traits']
72+
# this is a metadata key in the spec that is matched
7373
# specially in _filter_pools_based_on_placement_allocation. So we can
7474
# ignore them in the general matching logic.
75-
ignored_tags += ['rp_uuid', 'rp_uuids']
75+
ignored_spec_tags += ['rp_uuids']
76+
# this is a metadata key in the pool that is matched
77+
# specially in _filter_pools_based_on_placement_allocation. So we can
78+
# ignore them in the general matching logic.
79+
ignored_pool_tags += ['rp_uuid']
7680

7781
def __init__(
7882
self,
@@ -146,7 +150,11 @@ def _create_pool_keys_from_dev(
146150

147151
if tags:
148152
pool.update(
149-
{k: v for k, v in tags.items() if k not in self.ignored_tags}
153+
{
154+
k: v
155+
for k, v in tags.items()
156+
if k not in self.ignored_pool_tags
157+
}
150158
)
151159
# NOTE(gibi): since PCI in placement maps a PCI dev or a PF to a
152160
# single RP and the scheduler allocates from a specific RP we need
@@ -358,7 +366,9 @@ def _filter_pools_for_spec(
358366

359367
def ignore_keys(spec):
360368
return {
361-
k: v for k, v in spec.items() if k not in self.ignored_tags
369+
k: v
370+
for k, v in spec.items()
371+
if k not in self.ignored_spec_tags
362372
}
363373

364374
request_specs = [ignore_keys(spec) for spec in request.spec]

0 commit comments

Comments
 (0)