Add Xapi_pci_helpers to parse the pci.ids database

This will replace the python script scripts/pci-info when finished.

Initial implementation: parses file into datastructure.

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Removed redunandant information from PCI_DB.t

Removed the keys from the object themselves. Runs 30% quicker.

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Filter comments correctly from pci.ids

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Added print methods to Xapi_pci_helpers for testing

Reconstructs the string representation of the database after parsing which can
be used for testing.

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Added corporate header to Xapi_pci_helpers module

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Xapi_pci_helpers factored parse function into PCI_DB module

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Expose pci type in Xapi_pci module

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Use lspci with PCI_DB to get host PCI devices

Get the devices on a host using `lspci -mnD` and extract extra information from
pci.ids to give back a list of pcis for the host machine.

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Fix build warnings for Xapi_pci_helpers and add to build

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Factor out Pci_db into separate module for use by Xapi_pci_helpers

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Move Xapi_pci over to use Pci_db and Xapi_pci_helpers

This replaces the need for the pci-info python script and gives a richer
data structure to query. This is going to be useful for the vGPU work.

Also moved out test code from the initialisation of the Xapi_pci_helpers and
Pci_db modules into tests so that they don't barf on stdout on initialisation.
These tests are currently disabled (see skip boolean in each module) so that
they don't barf on build.

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
CP-5597: Add Xapi_VGPU_type functionality

Create VGPU types for each GPU group when it is made. This parses the config
files from NVIDIA but has been written with multiple vGPU vendors in mind.

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
CP-5597: Add garbage collection for VGPU_types

Add database relation between VGPU types and the groups that they're associated
with.

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
CP-5597: Update GPU group's supported vGPU types on addition to the group

When a PGPU is added to a GPU group, the supported vGPU types are updated. This
means that when a PGPU is added to an empty group or the last PGPU is removed
from a group the supported types are added and removed respectively.

Aside: Moved to using int64 within xapi for the pci_{class, vendor, device,
subvendor, subdevice}_id. This enables better comparison rather than struggling
with discrepencies between database and vGPU conf files (leading '0x',
case-mismatch).

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
CP-5597: Raise error when attempting to create vGPU without allowed VGPU_type

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Merge pull request #1385 from simonjbeaumont/cp-5597

CP-5597: Add VGPU_type functionality