第6章 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.
Prerequisites
- The Compute nodes have the required PCI devices.
6.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
- configure a new overcloud flavor for PCI passthrough to use to tag the Compute nodes for PCI passthrough
Procedure
Generate a new roles data file named
roles_data_pci_passthrough.yamlthat includes theController,Compute, andComputePCIroles:openstack overcloud roles \ generate -o /home/stack/templates/roles_data_pci_passthrough.yaml \ Compute:ComputePCI Compute Controller
(undercloud)$ openstack overcloud roles \ generate -o /home/stack/templates/roles_data_pci_passthrough.yaml \ Compute:ComputePCI Compute ControllerCopy to Clipboard Copied! Toggle word wrap Toggle overflow Open
roles_data_pci_passthrough.yamland edit or add the following parameters and sections:Expand Section/Parameter Current value New value Role comment
Role: ComputeRole: ComputePCIRole name
name: Computename: ComputePCIdescriptionBasic Compute Node rolePCI Passthrough Compute Node roleHostnameFormatDefault%stackname%-novacompute-%index%%stackname%-novacomputepci-%index%deprecated_nic_config_namecompute.yamlcompute-pci-passthrough.yaml-
Register the PCI passthrough Compute nodes for the overcloud by adding them to your node definition template,
node.jsonornode.yaml. For more information, see Registering nodes for the overcloud in the Director Installation and Usage guide. Inspect the node hardware:
openstack overcloud node introspect \ --all-manageable --provide
(undercloud)$ openstack overcloud node introspect \ --all-manageable --provideCopy to Clipboard Copied! Toggle word wrap Toggle overflow For more information, see Inspecting the hardware of nodes in the Director Installation and Usage guide.
Create the
compute-pci-passthroughbare metal flavor to use to tag nodes that you want to designate for PCI passthrough:openstack flavor create --id auto \ --ram <ram_size_mb> --disk <disk_size_gb> \ --vcpus <no_vcpus> compute-pci-passthrough
(undercloud)$ openstack flavor create --id auto \ --ram <ram_size_mb> --disk <disk_size_gb> \ --vcpus <no_vcpus> compute-pci-passthroughCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
Replace
<ram_size_mb>with the RAM of the bare metal node, in MB. -
Replace
<disk_size_gb>with the size of the disk on the bare metal node, in GB. Replace
<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.
-
Replace
Tag each bare metal node that you want to designate for PCI passthrough with a custom PCI passthrough resource class:
openstack baremetal node set \ --resource-class baremetal.PCI-PASSTHROUGH <node>
(undercloud)$ openstack baremetal node set \ --resource-class baremetal.PCI-PASSTHROUGH <node>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace
<node>with the ID of the bare metal node.Associate the
compute-pci-passthroughflavor with the custom PCI passthrough resource class:openstack flavor set \ --property resources:CUSTOM_BAREMETAL_PCI_PASSTHROUGH=1 \ compute-pci-passthrough
(undercloud)$ openstack flavor set \ --property resources:CUSTOM_BAREMETAL_PCI_PASSTHROUGH=1 \ compute-pci-passthroughCopy to Clipboard Copied! Toggle word wrap Toggle overflow 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
CUSTOM_.注記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:
openstack flavor set \ --property resources:VCPU=0 --property resources:MEMORY_MB=0 \ --property resources:DISK_GB=0 compute-pci-passthrough
(undercloud)$ openstack flavor set \ --property resources:VCPU=0 --property resources:MEMORY_MB=0 \ --property resources:DISK_GB=0 compute-pci-passthroughCopy to Clipboard Copied! Toggle word wrap Toggle overflow 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
parameter_defaults: OvercloudComputePCIFlavor: compute-pci-passthrough ComputePCICount: 3Copy to Clipboard Copied! Toggle word wrap Toggle overflow To verify that the role was created, enter the following command:
openstack overcloud profiles list
(undercloud)$ openstack overcloud profiles listCopy to Clipboard Copied! Toggle word wrap Toggle overflow