@@ -371,19 +371,52 @@ def _filter_pools(cls, pools, request, numa_cells):
371
371
372
372
# Firstly, let's exclude all devices that don't match our spec (e.g.
373
373
# they've got different PCI IDs or something)
374
+ before_count = sum ([pool ['count' ] for pool in pools ])
374
375
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
375
387
376
388
# Next, let's exclude all devices that aren't on the correct NUMA node
377
389
# *assuming* we have devices and care about that, as determined by
378
390
# policy
391
+ before_count = after_count
379
392
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
380
404
381
405
# Finally, if we're not requesting PFs then we should not use these.
382
406
# Exclude them.
407
+ before_count = after_count
383
408
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
+ )
384
417
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' )
387
420
return None
388
421
389
422
return pools
0 commit comments