Add Virtual GPU Config to nova.conf template

Currently, the list of supported vGPUs is populated automatically
within the Nova playbook when the /sys/class/mdev_bus folder is
present. This will populate the `enabled_vgpu_types` variable with
the full list of vGPUs that are supported by default, with only
the first one listed being used.

This change provides the ability to define a new variable
`nova_enabled_vgpu_types` that will populate the enabled_vgpu_types
config option. It also adds the ability to map vgpu types to PCI
addresses in line with Ussuri updates to provide multi-vGPU support.

Change-Id: Icc0c2cd896d4c9a01601d4d733f38443ad8400d4
This commit is contained in:
Danny Meloy 2020-12-21 17:44:35 +00:00
parent 43b1b62f22
commit 3edfbe6896
3 changed files with 22 additions and 3 deletions

View File

@ -506,6 +506,20 @@ nova_vendor_data_overrides: {}
nova_api_metadata_uwsgi_ini_overrides: {}
nova_api_os_compute_uwsgi_ini_overrides: {}
# Enabled vGPU Types - dict defining 'type' and 'address' (optional) of vGPU
# an address is only required when supporting more than one physical GPU on the host
# Example 1:
# nova_enabled_vgpu_types:
# - type: nvidia-35
#
# Example 2:
# nova_enabled_vgpu_types:
# - type: nvidia-35
# address: <device address>
# - type: nvidia-36
# address: <another device address>
nova_enabled_vgpu_types: {}
# PCI devices passthrough to nova
# For SR-IOV please use:
# nova_pci_passthrough_whitelist: '{ "physical_network": "<ml2 network name>", "devname": "<physical nic>" }'

View File

@ -24,7 +24,7 @@
- name: Register a fact for nova enabled_vgpu_types
set_fact:
enabled_vgpu_types: "{{ mdev.stdout_lines | unique }}"
discovered_vgpu_types: "{{ mdev.stdout_lines | unique }}"
when:
- mdev.stdout_lines is defined
- mdev.stdout_lines | length > 0

View File

@ -293,9 +293,14 @@ tracks_instance_changes = {{ nova_scheduler_tracks_instance_changes }}
[upgrade_levels]
compute=auto
{% if enabled_vgpu_types is defined %}
{% if nova_enabled_vgpu_types | length > 0 or discovered_vgpu_types is defined %}
[devices]
enabled_vgpu_types = {{ enabled_vgpu_types | join(',') }}
enabled_vgpu_types = {{ nova_enabled_vgpu_types | map(attribute='type') | list | default(discovered_vgpu_types, true) | unique | join(',') }}
{% for record in nova_enabled_vgpu_types | selectattr('address', 'defined') | list %}
[vgpu_{{ record.type }}]
device_addresses = {{ record.address }}
{% endfor %}
{% endif %}
{% if nova_pci_passthrough_whitelist or nova_pci_alias %}