diff options
author | Stephen Finucane <stephenfin@redhat.com> | 2020-11-26 16:17:21 +0000 |
---|---|---|
committer | Stephen Finucane <stephenfin@redhat.com> | 2020-11-26 18:07:29 +0000 |
commit | adc705ee0ccf1bd406190a631eb1857aa5a397bf (patch) | |
tree | 04cbf6a74316917cd3c3db6c9c2575db5c48e4c4 /nova/tests/unit/pci/test_stats.py | |
parent | 5dbfbe692f7de33069746e4dc07bcbf0dd33f656 (diff) | |
download | nova-adc705ee0ccf1bd406190a631eb1857aa5a397bf.tar.gz |
pci: Add a '_filter_pools' helper function
Two functions, 'consume_requests' and 'apply_requests' (via the
'_apply_request' helper), used very similar code to identify the PCI
device pools that could be used to satisfy a request for PCI devices.
Rather than duplicating this code, introduce a new '_filter_pools'
helper than will do this filtering and return a list of matching pools,
if any. This is essentially the old '_apply_request' function without
any decreasing of pool count information.
While we're here, we inline a simple function with a single caller and
add whitespace to make things a little easier to grok.
Change-Id: Icf3d684446e01d2c04d91954a1fd0ec659b418e3
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Related-Bug: #1852727
Diffstat (limited to 'nova/tests/unit/pci/test_stats.py')
-rw-r--r-- | nova/tests/unit/pci/test_stats.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/nova/tests/unit/pci/test_stats.py b/nova/tests/unit/pci/test_stats.py index 6c1e55f8cd..3e73dedaac 100644 --- a/nova/tests/unit/pci/test_stats.py +++ b/nova/tests/unit/pci/test_stats.py @@ -150,6 +150,7 @@ class PciDeviceStatsTestCase(test.NoDBTestCase): set(['v1', 'v2', 'v3'])) def test_apply_requests(self): + self.assertEqual(len(self.pci_stats.pools), 3) self.pci_stats.apply_requests(pci_requests) self.assertEqual(len(self.pci_stats.pools), 2) self.assertEqual(self.pci_stats.pools[0]['vendor_id'], 'v1') |