Jump to: navigation, search

Pci-api-support

PCI passthrough support in nova enables assigning a PCI device to an instance in openstack. 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.

Use case

List and show PCI devices on VMs

  • The use case starts with User logging in as Administrator using CLI, Web GUI or Management application.
  • User issues 'nova show or nova list ' command, User can know which PCI device used by VM.
  • System retrieves the VM information form the database.
  • System outputs the list of the devices to CLI, Web GUI or Management Application. The description in the list consists of the following:
  1. PCI device UUID

List and show PCI stats on hypervisors

  • The use case starts with User logging in as Administrator using CLI, Web GUI or Management application.
  • User issues 'nova hypervisor-show or nova hypervisor-list ' command, User can know PCI device stats on hypervisor.
  • System retrieves the hypervisor information form the database.
  • System outputs the list of the devices to CLI, Web GUI or Management Application. The description in the list consists of the following:
  1. PCI device stats

List PCI devices on the nodes

  • The use case starts with User logging in as Administrator using CLI, Web GUI or Management application.
  • User issues 'list PCI devices' command .
  • System retrieves the list of devices form the database.
  • System outputs the list of the devices to CLI, Web GUI or Management Application. The PCI device description in the list consists of the following:
  1. device UUID
  2. device name
  3. Device PCI ID (Vendor ID/Device ID)
  4. node ID

Get PCI device detailed information

  • The use case starts with User logging in as Administrator using CLI, Web GUI or Management application.
  • User follows List PCI devices on the nodes use-case to obtain the PCI device UUID or the PCI device name.
  • User issues 'show PCI device details' command using either the device UUID or the device name using CLI, Web GUI or Management Application.
  • System retrieves device information from the database.
  • System outputs the details of the PCI device to CLI, Web GUI or Management Application. The details contain:
  1. device Name
  2. device UUID
  3. device PCI ID (Vendor ID/Device ID)
  4. device type
  5. device allocation status
  6. extra_info
  7. instance UUID
  8. other infomation

What the REST PCI API will look like

The PCI API should incloude 3 interfaces:

  1. We should extend server API to add PCI assignment information. When you use the server API, the result contains the PCI device information. For example:

Use case: List an show PCI devices on VMs Request:

   GET v2/​{tenant_id}​/servers/​{server_id}

Nova-client command :

  nova list
  nova show VM name 

The response JSON will contain the variable "os-pci:pci_devices":

   { "server": {"os-pci:pci_devices": [{"id": 1}], "tenant_id": "openstack", "user_id": "fake"}}

you can see which PCI device was used by the server of interest to you. The value of "os-pci-devices" means this VM used one PCI device(id=1).

  1. We also should extend hypervisor API to add PCI stats information. We use the hypervisor api can also get the PCI stats in the results. For example:

Use case : List an show PCI stats on hypervisors  Request:

   GET v2/​{tenant_id}​/os-hypervisors/​{hypervisor_hostname}

Nova-client command :

  nova hypervisor-list
  nova hypervisor-show id 

The response JOSN contains the variable "pci_stats":

   {"hypervisor": {"pci_stats": [{"count": 5, "vendor_id": "8086", "product_id": "1520", "extra_info": {"phys_function": "abc", "key1": "value1"}}}]}
  1. We also need to add PCI APIs like to get PCI device information.

Use case : List PCI devices on the nodes  Request:

    GET v2/​{tenant_id}/​os-pci

Nova-client command :

  nova pci-list

 The response JSON may like below :

   {"pci_devices": [{ "address": "0000:04:10.0",  "compute_node_id": 1, "id": 1, "product_id": "1520",  "status": "available",  "vendor_id": "8086" } ]}

Request:

    GET v2/​{tenant_id}/​os-pci/detail

The response JSON may like below :

   { "pci_devices": [ { "address": "0000:04:10.0", "compute_node_id": 1, "created_at": null, "deleted": false,  "deleted_at": null, "dev_id": "pci_0000_04_10_0",  "dev_type": "type-VF", "extra_info": { "key1": "value1", "key2": "value2", "phys_function": "0x004" }, "id": 1, "instance_uuid": "246ca", "label": "label_8086_1520", "product_id": "1520", "status": "available",  "updated_at": null, "vendor_id": "8086"}]}

Use case : Show PCI device infomation Request:

   GET v2/​{tenant_id}/​os-pci/{pci_device_id}

Nova-client command :

  nova pci-show id 

The response JSON may like below :

   {"pci_device": { "address": "0000:04:10.0","compute_node_id": 1, "created_at": null, "deleted": false, "deleted_at": null, "dev_id": "pci_0000_04_10_0", "dev_type": "type-VF", "extra_info": {"key1": "value1", "key2": "value2", "phys_function": "0x004"}, "id": 1, "instance_uuid": "246ca", "label": "label_8086_1520", "product_id": "1520",  "status": "available",  "updated_at": null, "vendor_id": "8086"}}

We intend to add the PCI APIs into V2 and V3. The patch may be big, so I want to split the patch into 3 parts in V2 and V3.

  1. extend the sever API.
  2. extend hypervisor API.
  3. add PCI API.