diff --git a/cyborg/conf/devices.py b/cyborg/conf/devices.py index 73439e5b..454f5b4a 100644 --- a/cyborg/conf/devices.py +++ b/cyborg/conf/devices.py @@ -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} diff --git a/releasenotes/notes/configure-multiple-vgpu-types-a60d09dfb5b7be4b.yaml b/releasenotes/notes/configure-multiple-vgpu-types-a60d09dfb5b7be4b.yaml new file mode 100644 index 00000000..4c815859 --- /dev/null +++ b/releasenotes/notes/configure-multiple-vgpu-types-a60d09dfb5b7be4b.yaml @@ -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.