Managing GPU-based flavors

GPU-based flavors define the GPU alias and quantity attached to a virtual machine. One GPU alias can be used for different flavors.

Limitations

  • Changing GPU quantity in a flavor affects only new virtual machines. Existing VMs retain their original GPU configuration.

Prerequisites

To add a GPU to a flavor

Use the following command:

vinfra service compute flavor set [--gpu <alias:count>] <flavor>
<flavor>
Flavor ID or name
--gpu <alias:count>
GPU configuration in alias:count format (e.g., L40S:2). Can be specified multiple times. The system will automatically determine the GPU type (vGPU or host passthrough) and set the appropriate flavor properties.

For example, to add 2 GPUs with the alias nvidia-319 to the flavor gpu-nvidia-319-2, run:

# vinfra service compute flavor set gpu-nvidia-319-2 --gpu nvidia-319:2

To remove a GPU from a flavor

Use the following command:

vinfra service compute flavor unset --property <property-key> [<property-key> ...] <flavor>
<flavor>
Flavor ID or name
--property <property-key> [<property-key> ...]
Property key to remove from the flavor. Can be specified multiple times.

For example, to remove 2 GPUs with the alias nvidia-319 from the flavor gpu-nvidia-319-2, run:

# vinfra service compute flavor unset gpu-nvidia-319-2 --property "resources:VGPU" "trait:CUSTOM_NVIDIA_319"
+-------------+--------------------------------------+
| Field       | Value                                |
+-------------+--------------------------------------+
| access_list | []                                   |
| gpu         | 0                                    |
| id          | e6c59a72-c297-439b-afa5-058e97b263f6 |
| is_public   | True                                 |
| name        | gpu-nvidia-319-2                     |
| properties  | {}                                   |
| ram         | 65536                                |
| swap        | 0                                    |
| vcpus       | 16                                   |
+-------------+--------------------------------------+