Jump to: navigation, search

Difference between revisions of "Pci passthrough"

m
Line 1: Line 1:
PCI passthrough support enables assigning a PCI device to an instance in openstack.
+
PCI passthrough support in nova enables assigning a PCI device to an instance in openstack.
  
== Where to get the code: ==
+
=== 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.  
 
Currently all the core functionality is merged into nova upstream. With this support, it's ok to create instances with devices assignment.  
Line 11: Line 11:
 
== How to prepare the environment ==
 
== How to prepare the environment ==
  
1. Configure the nova
+
# Configure the nova
Compute node:  
+
* Compute node:  
 +
 
 
pci_passthrough_whitelist: White list of PCI devices available to VMs.
 
pci_passthrough_whitelist: White list of PCI devices available to VMs.
  
Line 18: Line 19:
 
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.
 
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:  
+
*Controller node:  
 
pci_alias: An alias for a PCI passthrough device requirement.
 
pci_alias: An alias for a PCI passthrough device requirement.
 
For example:
 
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.
 
  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.
  
2. Create a flavor
+
# Create a flavor
 
Configure a flavor that request pci devices. For example:
 
Configure a flavor that request pci devices. For example:
 
nova flavor-key  m1.large set  "pci_passthrough:alias"="a1:2"
 
nova flavor-key  m1.large set  "pci_passthrough:alias"="a1:2"
Line 29: Line 30:
 
update a flavor that requires two PCI devices, each with vendor_id as '0x8086' and product_id as '0x1520'.
 
update a flavor that requires two PCI devices, each with vendor_id as '0x8086' and product_id as '0x1520'.
  
 
+
# Create a VM
3. create a VM
 
 
  nova boot --image new1 --key_name test --flavor m1.large 123
 
  nova boot --image new1 --key_name test --flavor m1.large 123
  
 
the image is the image contains the driver to the assigned devices, the 'test' is the key pair.
 
the image is the image contains the driver to the assigned devices, the 'test' is the key pair.
  
4. 'nova show 123' to check VM status till it's become active.
+
# 'nova show 123' to check VM status till it's become active.
  
5. nova ssh --private 123 -i test.pem to login into the guest, 'lspci' will show you all the devices.
+
# 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 paches ===
 
== How to check PCI status with PCI api paches ===
 +
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:
 +
 +
    "compute_extension:instance_pci": "",
 +
    "compute_extension:pci": "rule:admin_api",
 +
 +
Restart the nova api service.
 +
 +
* 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 compue_node in the system.
 
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 compue_node in the system.
  

Revision as of 05:53, 10 September 2013

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. Draft 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

  1. 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.
  1. Create a flavor

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'.

  1. Create a VM
nova boot --image new1 --key_name test --flavor m1.large 123

the image is the image contains the driver to the assigned devices, the 'test' is the key pair.

  1. 'nova show 123' to check VM status till it's become active.
  1. 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 paches =

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.

   "compute_extension:instance_pci": "",
   "compute_extension:pci": "rule:admin_api",

Restart the nova api service.

  • 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 compue_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.