Jump to: navigation, search

Pci passthrough

Revision as of 20:13, 31 October 2014 by Yunhong-jiang (talk | contribs) (Create a VM)

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 pasthrough 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:
scheduler_driver=nova.scheduler.filter_scheduler.FilterScheduler
scheduler_available_filters=nova.scheduler.filters.all_filters
scheduler_available_filters=nova.scheduler.filters.pci_passthrough_filter.PciPassthroughFilter
scheduler_default_filters=RamFilter,ComputeFilter,AvailabilityZoneFilter,ComputeCapabilitiesFilter,ImagePropertiesFilter,PciPassthroughFilter

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 passthrough use notes

  • alias "device_type"

alias define with device_type is optional, currely there is no way to discovery the type of PCI device from hypervisor, so don't define device_type in alias now:

pci_alias={"vendor_id":"8086", "product_id":"1520", "name":"a1, "device_type":"NIC""}

if a alias with "device_type" defined in nova.conf, "device_type" will be part of spec of pci request, and will failed to schedule a compute node to meet this request. this behavior might need improve with a enhancement scheduler which can be configrable to ignore device type.