Improve backwards compatibility of VGPU.create

If a client doesn't specify a VPGU_type when creating a VGPU, the server
will send us the default value of Ref.null. Here, we convert this into
the passthrough VGPU_type.

Signed-off-by: John Else <john.else@citrix.com>
Merge pull request #1402 from johnelse/vgpu-create

Improve backwards compatibility of VGPU.create
CP-5642: Make snapshots with VGPUs revertable

Snapshots with VGPUs would not revert in the case where the snapshotee had been
destroyed. This is because the VGPUs field was copied into the reverted VM but
the reference didn't point to a valid VGPU object since it wasn't recreated (it
was destroyed when the VM was originally destroyed).

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

Make snapshots with VGPUs revertable
CP-5881: Update VGPU_types for PGPUs on startup

VGPU_types for existing PGPUs are updated during update_gpus (at db_sync time).
This will allow xapi to pick up any changes to the host system which might
introduce more supported VGPU_types (i.e. installing the NVIDIA VGX rpm).

Consequently, if any such VGPU_types are no longer supported as a result of
changes on the host (i.e. uninstalling the rpm), then the VGPU_types will be
garbage collected as they are not in use by any PGPUs.

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
CP-5881: Use same pci_db for all PGPU updates

Optimisation: find_or_create_supported_types for a PGPU was reconsructing the
entire Pci_db from file each time. Now, the Pci_db can be created and passed in
so it can be reused over all PGPUs that need updating.

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

Update supported vGPU types at startup
CP-5881: Don't enable new vGPU types on startup

If new vGPU types become supported then don't enable them by default (doing so
might mess up a users reservation plans).

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
CP-5881: Disable any newly-unsupported vGPU types

If vGPU types become unsupported (as a result of uninstalling the necessary
rpms from the vGPU vendor) then we should remove those types from the enabled
types of the PGPU.

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

Don't enable newly discovered vGPU types on startup
CP-5840: Populate new PGPU fields when upgrading the DB

Signed-off-by: John Else <john.else@citrix.com>
CP-5840: Make use of re-usable Pci_db optimisation

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
CP-5840: Set VGPU types when upgrading the DB

All existing VGPUs will be given the special "passthrough" VGPU type.

Signed-off-by: John Else <john.else@citrix.com>
CP-5840: Bump DB schema so that the upgrade runs

Signed-off-by: John Else <john.else@citrix.com>
Merge pull request #1406 from simonjbeaumont/cp-5840

Database upgrade logic for vGPU support
Fix typo in logging for VGPU.destroy

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Merge pull request #1408 from simonjbeaumont/vgpu-log-typo

Fix typo in logging for VGPU.destroy
Bash completion for xe vgpu-type-list uuid=<TAB>

This was erroneously showing the uuids for vgpus, not vgpu-types.

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Add type-model-name field vgpu-type-param-list

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Merge pull request #1409 from simonjbeaumont/vgpu-cli-improvements

vGPU-related CLI improvements