The nova.pci.stats Module

class PciDeviceStats(stats=None)

Bases: object

PCI devices summary information.

According to the PCI SR-IOV spec, a PCI physical function can have up to 256 PCI virtual functions, thus the number of assignable PCI functions in a cloud can be big. The scheduler needs to know all device availability information in order to determine which compute hosts can support a PCI request. Passing individual virtual device information to the scheduler does not scale, so we provide summary information.

Usually the virtual functions provided by a host PCI device have the same value for most properties, like vendor_id, product_id and class type. The PCI stats class summarizes this information for the scheduler.

The pci stats information is maintained exclusively by compute node resource tracker and updated to database. The scheduler fetches the information and selects the compute node accordingly. If a compute node is selected, the resource tracker allocates the devices to the instance and updates the pci stats information.

This summary information will be helpful for cloud management also.


Add a device to its matching pool.

apply_requests(requests, numa_cells=None)

Apply PCI requests to the PCI stats.

This is used in multiple instance creation, when the scheduler has to maintain how the resources are consumed by the instances. If numa_cells is provided then only devices contained in those nodes are considered.


Clear all the stats maintained.

consume_requests(pci_requests, numa_cells=None)
pool_keys = ['product_id', 'vendor_id', 'numa_node', 'dev_type']

Remove one device from the first pool that it matches.

support_requests(requests, numa_cells=None)

Check if the pci requests can be met.

Scheduler checks compute node’s PCI stats to decide if an instance can be scheduled into the node. Support does not mean real allocation. If numa_cells is provided then only devices contained in those nodes are considered.


Return the contents of the pools as a PciDevicePoolList object.

Previous topic

The nova.pci.request Module

Next topic

The nova.pci.utils Module

Project Source

This Page