第5章 Configuring PCI passthrough
You can use PCI passthrough to attach a physical PCI device, such as a graphics card or a network device, to an instance. If you use PCI passthrough for a device, the instance reserves exclusive access to the device for performing tasks, and the device is not available to the host.
Using PCI passthrough with routed provider networks
The Compute service does not support single networks that span multiple provider networks. When a network contains multiple physical networks, the Compute service only uses the first physical network. Therefore, if you are using routed provider networks you must use the same
physical_network name across all the Compute nodes.
If you use routed provider networks with VLAN or flat networks, you must use the same
physical_network name for all segments. You then create multiple segments for the network and map the segments to the appropriate subnets.
To enable your cloud users to create instances with PCI devices attached, you must complete the following:
- Designate Compute nodes for PCI passthrough.
- Configure the Compute nodes for PCI passthrough that have the required PCI devices.
- Deploy the overcloud.
- Create a flavor for launching instances with PCI devices attached.
- The Compute nodes have the required PCI devices.
5.1. Designating Compute nodes for PCI passthrough
To designate Compute nodes for instances with physical PCI devices attached, you must create a new role file to configure the PCI passthrough role, and configure a new overcloud flavor and PCI passthrough resource class to use to tag the Compute nodes for PCI passthrough.
Log in to the undercloud as the
[stack@director ~]$ source ~/stackrc
Generate a new roles data file named
roles_data_pci_passthrough.yamlthat includes the
(undercloud)$ openstack overcloud roles \ generate -o /home/stack/templates/roles_data_pci_passthrough.yaml \ Compute:ComputePCI Compute Controller
roles_data_pci_passthrough.yamland edit or add the following parameters and sections:
Section/Parameter Current value New value
Basic Compute Node role
PCI Passthrough Compute Node role
Register the PCI passthrough Compute nodes for the overcloud by adding them to your node definition template,
node.yaml. For more information, see Registering nodes for the overcloud in the Director Installation and Usage guide.
Inspect the node hardware:
(undercloud)$ openstack overcloud node introspect \ --all-manageable --provide
For more information, see the relevant section in the Director Installation and Usage guide:
compute-pci-passthroughovercloud flavor for PCI passthrough Compute nodes:
(undercloud)$ openstack flavor create --id auto \ --ram <ram_size_mb> --disk <disk_size_gb> \ --vcpus <no_vcpus> compute-pci-passthrough
<ram_size_mb>with the RAM of the bare metal node, in MB.
<disk_size_gb>with the size of the disk on the bare metal node, in GB.
<no_vcpus>with the number of CPUs on the bare metal node.注記
These properties are not used for scheduling instances. However, the Compute scheduler does use the disk size to determine the root partition size.
Tag each bare metal node that you want to designate for PCI passthrough with a custom PCI passthrough resource class:
(undercloud)$ openstack baremetal node set \ --resource-class baremetal.PCI-PASSTHROUGH <node>
<node>with the ID of the bare metal node.
compute-pci-passthroughflavor with the custom PCI passthrough resource class:
(undercloud)$ openstack flavor set \ --property resources:CUSTOM_BAREMETAL_PCI_PASSTHROUGH=1 \ compute-pci-passthrough
To determine the name of a custom resource class that corresponds to a resource class of a Bare Metal service node, convert the resource class to uppercase, replace all punctuation with an underscore, and prefix with
A flavor can request only one instance of a bare metal resource class.
Set the following flavor properties to prevent the Compute scheduler from using the bare metal flavor properties to schedule instances:
(undercloud)$ openstack flavor set \ --property resources:VCPU=0 --property resources:MEMORY_MB=0 \ --property resources:DISK_GB=0 compute-pci-passthrough
Add the following parameters to the
node-info.yamlfile to specify the number of PCI passthrough Compute nodes, and the flavor to use for the PCI passthrough designated Compute nodes:
parameter_defaults: OvercloudComputePCIFlavor: compute-pci-passthrough ComputePCICount: 3
To verify that the role was created, enter the following command:
(undercloud)$ openstack overcloud profiles list