Jump to: navigation, search

Pci passthrough

Revision as of 16:50, 10 February 2017 by Stephen-finucane (talk | contribs) (Note that this page is no longer that valid)

The information on this page is significantly out-of-date. Refer to the documentation for more recent information.

Please check https://wiki.openstack.org/wiki/SR-IOV-Passthrough-For-Networking for SR-IOV NIC pass-through

PCI passthrough support in nova enables assigning a PCI device to an instance in OpenStack.

Where to get the code

Currently all the core functionality is merged into nova upstream. With this support, it's ok to create instances with devices assignment.

However, the API support is still not pushed out, because of time reason. Test-purpose patches for both nova-client and nova is available at https://github.com/yjiang5/pci_api.git . We will submit the patch once the tree is open again.

How to prepare the environment

Please make sure your compute node have PCI passthrough support enabled per http://www.linux-kvm.org/page/How_to_assign_devices_with_VT-d_in_KVM

Configure the nova

  • Compute node:
pci_passthrough_whitelist: White list of PCI devices available to VMs.
For example:
pci_passthrough_whitelist=[{ "vendor_id":"8086","product_id":"1520"}] 
defines all PCI devices in the platform with vendor_id as 0x8086 and :product_id as 0x1520 will be assignable to the instances.
  • Controller node:
pci_alias: An alias for a PCI passthrough device requirement.
For example:
pci_alias={"vendor_id":"8086", "product_id":"1520", "name":"a1"}
defines pci alias 'a1' to present a request for PCI devices with vendor_id as 0x8086 and product_id as 0x1520.
  • Scheduler node:
enable pci devices filter.
For example:

Create a flavor

You don't need this step for SR-IOV NIC support. Please check https://wiki.openstack.org/wiki/SR-IOV-Passthrough-For-Networking for passing PCI device request through port creation

Configure a flavor that request pci devices. For example:
nova flavor-key  m1.large set  "pci_passthrough:alias"="a1:2"
update a flavor that requires two PCI devices, each with vendor_id as '0x8086' and product_id as '0x1520'.

Create a VM

'Please check https://wiki.openstack.org/wiki/SR-IOV-Passthrough-For-Networking for passing PCI device request port-id

nova boot --image new1 --key_name test --flavor m1.large 123

create a VM with the PCI requirements. The image is the image contains the driver to the assigned devices, the 'test' is the key pair.

Check assignment instance

'nova show 123'
to check VM status till it's become active.
nova ssh --private 123 -i test.pem
to login into the guest, 'lspci' will show you all the devices.

How to check PCI status with PCI API patches

The PCI API patches extends the servers/os-hypervisor to show PCI information for instance and compute node, and also provides a resource :endpoint to show PCI information.
  • Get the patches from https://github.com/yjiang5/pci_api.git , apply the patch or copy the extension plugin files. Update the policy file with two new policy and restart the nova API service.
   "compute_extension:instance_pci": "",
   "compute_extension:pci": "rule:admin_api",

  • Try the PCI API.
nova pci-list node_id
will show all PCI devices on a compute node with node_id as the id. (Use 'nova hypervisor-list' to get all compute_node in the system.)
nova list
will get the pci assignment to a instance, the 'os-pci:pci' contains the id of the PCI device.
nova pci-show id
shows the details of a PCI device.

PCI PF passthrough Notes

To boot the VM with a Physical PCI Function instead of Virtual Function, need to define the alias with explicitly specify the device_type as "type-PF". Omit "device_type" field PCI scheduler will remove all PF from candidate devices. Example:

pci_alias={"vendor_id":"8086", "product_id":"1520", "name":"a1", "device_type":"type-PF"}
# Note: Don't append any spaces character to pci_alias definition.

By assign "device_type" in the alias, PCI scheduler then could assign the request PF devices to the VM.