6.2. Configuring a PCI passthrough Compute node
To enable your cloud users to create instances with PCI devices attached, you must configure both the Compute nodes that have the PCI devices and the Controller nodes.
Procedure
-
Create an environment file to configure the Controller node on the overcloud for PCI passthrough, for example,
pci_passthrough_controller.yaml
. Add
PciPassthroughFilter
to theNovaSchedulerDefaultFilters
parameter inpci_passthrough_controller.yaml
:parameter_defaults: NovaSchedulerDefaultFilters: ['AvailabilityZoneFilter','ComputeFilter','ComputeCapabilitiesFilter','ImagePropertiesFilter','ServerGroupAntiAffinityFilter','ServerGroupAffinityFilter','PciPassthroughFilter','NUMATopologyFilter']
parameter_defaults: NovaSchedulerDefaultFilters: ['AvailabilityZoneFilter','ComputeFilter','ComputeCapabilitiesFilter','ImagePropertiesFilter','ServerGroupAntiAffinityFilter','ServerGroupAffinityFilter','PciPassthroughFilter','NUMATopologyFilter']
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To specify the PCI alias for the devices on the Controller node, add the following configuration to
pci_passthrough_controller.yaml
:Copy to Clipboard Copied! Toggle word wrap Toggle overflow For more information about configuring the
device_type
field, see PCI passthrough device type field.注記If the
nova-api
service is running in a role different from theController
role, replaceControllerExtraConfig
with the user role in the format<Role>ExtraConfig
.Optional: To set a default NUMA affinity policy for PCI passthrough devices, add
numa_policy
to thenova::pci::aliases:
configuration from step 3:Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
To configure the Compute node on the overcloud for PCI passthrough, create an environment file, for example,
pci_passthrough_compute.yaml
. To specify the available PCIs for the devices on the Compute node, use the
vendor_id
andproduct_id
options to add all matching PCI devices to the pool of PCI devices available for passthrough to instances. For example, to add all Intel® Ethernet Controller X710 devices to the pool of PCI devices available for passthrough to instances, add the following configuration topci_passthrough_compute.yaml
:Copy to Clipboard Copied! Toggle word wrap Toggle overflow For more information about how to configure
NovaPCIPassthrough
, see Guidelines for configuringNovaPCIPassthrough
.You must create a copy of the PCI alias on the Compute node for instance migration and resize operations. To specify the PCI alias for the devices on the PCI passthrough Compute node, add the following to
pci_passthrough_compute.yaml
:Copy to Clipboard Copied! Toggle word wrap Toggle overflow 注記The Compute node aliases must be identical to the aliases on the Controller node. Therefore, if you added
numa_affinity
tonova::pci::aliases
inpci_passthrough_controller.yaml
, then you must also add it tonova::pci::aliases
inpci_passthrough_compute.yaml
.To enable IOMMU in the server BIOS of the Compute nodes to support PCI passthrough, add the
KernelArgs
parameter topci_passthrough_compute.yaml
. For example, use the followingKernalArgs
settings to enable an Intel IOMMU:parameter_defaults: ... ComputePCIParameters: KernelArgs: "intel_iommu=on iommu=pt"
parameter_defaults: ... ComputePCIParameters: KernelArgs: "intel_iommu=on iommu=pt"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To enable an AMD IOMMU, set
KernelArgs
to"amd_iommu=on iommu=pt"
.Add your custom environment files to the stack with your other environment files and deploy the overcloud:
openstack overcloud deploy --templates \ -e [your environment files] \ -e /home/stack/templates/pci_passthrough_controller.yaml \ -e /home/stack/templates/pci_passthrough_compute.yaml \
(undercloud)$ openstack overcloud deploy --templates \ -e [your environment files] \ -e /home/stack/templates/pci_passthrough_controller.yaml \ -e /home/stack/templates/pci_passthrough_compute.yaml \
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create and configure the flavors that your cloud users can use to request the PCI devices. The following example requests two devices, each with a vendor ID of
8086
and a product ID of1572
, using the alias defined in step 7:openstack flavor set \ --property "pci_passthrough:alias"="a1:2" device_passthrough
(overcloud)# openstack flavor set \ --property "pci_passthrough:alias"="a1:2" device_passthrough
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Create an instance with a PCI passthrough device:
openstack server create --flavor device_passthrough \ --image <image> --wait test-pci
# openstack server create --flavor device_passthrough \ --image <image> --wait test-pci
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Log in to the instance as a cloud user. For more information, see Log in to an Instance.
To verify that the PCI device is accessible from the instance, enter the following command from the instance:
lspci -nn | grep <device_name>
$ lspci -nn | grep <device_name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow