Skip to content

Commit d81ef45

Browse files
committed
pci: Add logging for filtering
This is possibly quite noisy, but it should give some kind of breadcrumb to suggest why a host was rejected. It can be particularly beneficial for devices with SR-IOV devices, which as noted on bug #1852727 are filtered out by default. Change-Id: I67455d4ecfafed96cb0f3f9fbe6f94808bd05909 Signed-off-by: Stephen Finucane <[email protected]> Related-Bug: #1852727
1 parent c2357ab commit d81ef45

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

nova/pci/stats.py

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,19 +371,52 @@ def _filter_pools(cls, pools, request, numa_cells):
371371

372372
# Firstly, let's exclude all devices that don't match our spec (e.g.
373373
# they've got different PCI IDs or something)
374+
before_count = sum([pool['count'] for pool in pools])
374375
pools = cls._filter_pools_for_spec(pools, request)
376+
after_count = sum([pool['count'] for pool in pools])
377+
378+
if after_count < before_count:
379+
LOG.debug(
380+
'Dropped %d devices due to mismatched PCI attribute(s)',
381+
before_count - after_count
382+
)
383+
384+
if after_count < request.count:
385+
LOG.debug('Not enough PCI devices left to satify request')
386+
return None
375387

376388
# Next, let's exclude all devices that aren't on the correct NUMA node
377389
# *assuming* we have devices and care about that, as determined by
378390
# policy
391+
before_count = after_count
379392
pools = cls._filter_pools_for_numa_cells(pools, request, numa_cells)
393+
after_count = sum([pool['count'] for pool in pools])
394+
395+
if after_count < before_count:
396+
LOG.debug(
397+
'Dropped %d devices as they are on the wrong NUMA node(s)',
398+
before_count - after_count
399+
)
400+
401+
if after_count < request.count:
402+
LOG.debug('Not enough PCI devices left to satify request')
403+
return None
380404

381405
# Finally, if we're not requesting PFs then we should not use these.
382406
# Exclude them.
407+
before_count = after_count
383408
pools = cls._filter_pools_for_unrequested_pfs(pools, request)
409+
after_count = sum([pool['count'] for pool in pools])
410+
411+
if after_count < before_count:
412+
LOG.debug(
413+
'Dropped %d devices as they are PFs which we have not '
414+
'requested',
415+
before_count - after_count
416+
)
384417

385-
# Do we still have enough devices left?
386-
if sum([pool['count'] for pool in pools]) < request.count:
418+
if after_count < request.count:
419+
LOG.debug('Not enough PCI devices left to satify request')
387420
return None
388421

389422
return pools

0 commit comments

Comments
 (0)