support configuring multiple vgpu types in cyborg

This patch defines the group and options for vgpu types configuration.

Co-Authored-By: Wenping Song <songwenping@inspur.com>

Change-Id: Ifbdf7f8fee663ddd28eeef9d7a804d29c0354c5f
Story: 2008265
Task: 41326
This commit is contained in:
Yumeng Bao 2020-11-27 19:49:57 +08:00 committed by songwenping
parent 82d1ed968b
commit 0605fe39fd
2 changed files with 56 additions and 1 deletions

View File

@ -27,10 +27,51 @@ nic_opts = [
help=" ")
]
gpu_group = cfg.OptGroup(
name='gpu_devices',
title='virtual gpu options',
help="""This is used to config vGPU types for nvidia GPU devices.
""")
vgpu_opts = [
cfg.ListOpt('enabled_vgpu_types',
default=[],
help="""
The vGPU types enabled in the compute node.
Cyborg supports multiple vGPU types in one host. Usually, a single physical
GPU can only set one vgpu type. Some pGPUs (e.g. NVIDIA GRID K1) support
multiple vGPU types.
If more than one single vGPU type are provided, then for each
*vGPU type*, you must add an additional section ``[vgpu_$(VGPU_TYPE)]`` with
a single configuration option ``device_addresses`` to assign this type to
the target physical GPU(s). PGPUs should be configured explictly now, we will
improve this after we implement the enable/disable interface.
If the same PCI address is provided for two different types, cyborg-agent will
return an InvalidGPUConfig exception at restart.
An example is as the following::
[gpu_devices]
enabled_vgpu_types = nvidia-35, nvidia-36
[vgpu_nvidia-35]
device_addresses = 0000:84:00.0,0000:85:00.0
[vgpu_nvidia-36]
device_addresses = 0000:86:00.0
""")
]
def register_opts(conf):
conf.register_group(nic_group)
conf.register_opts(nic_opts, group=nic_group)
conf.register_group(gpu_group)
conf.register_opts(vgpu_opts, group=gpu_group)
def register_dynamic_opts(conf):
@ -51,7 +92,13 @@ def register_dynamic_opts(conf):
# registering the '[nic_type]' groups in the process
for nic_type in conf.nic_devices.enabled_nic_types:
conf.register_opts(opts, group=nic_type)
# Register the '[vgpu_$(VGPU_TYPE)]/device_addresses' opts, implicitly
# registering the '[vgpu_$(VGPU_TYPE)]' groups in the process
opt = cfg.ListOpt('device_addresses', default=[],
item_type=cfg.types.String())
for vgpu_type in conf.gpu_devices.enabled_vgpu_types:
conf.register_opt(opt, group='vgpu_%s' % vgpu_type)
def list_opts():
return {nic_group: nic_opts}
return {nic_group: nic_opts, gpu_group: vgpu_opts}

View File

@ -0,0 +1,8 @@
---
features:
- |
The cyborg Nvidia GPU driver now supports defining different virtual GPU
types for each physical GPU. See the ``[gpu_devices]/enabled_vgpu_types``
configuration option for knowing how to do it. Please refer to
https://specs.openstack.org/openstack/cyborg-specs/specs/wallaby/approved/vgpu-driver-proposal.html
for further documentation.