Creating virtual machines with different vGPU types

If you want to use multiple vGPU types in the compute cluster, you need to manually create CUSTOM_NVIDIA_XXX traits and assign them to corresponding vGPU resource providers first. Then, you can proceed to create flavors and virtual machines with the assigned traits.

Limitations

  • Virtual machines with attached vGPUs cannot be suspended and live migrated.

Prerequisites

To configure multiple vGPU types for the compute cluster

  1. List resource providers in the compute cluster to obtain their IDs. For example:

    # openstack --insecure resource provider list
    +--------------------------------------+-----------------------------------------+------------+--------------------+----------------------+
    | uuid                                 | name                                    | generation | root_provider_uuid | parent_provider_uuid |
    +--------------------------------------+-----------------------------------------+------------+--------------------+----------------------+
    | 7d2ef259-42df-4ef8-8eaa-66c3b7448fc3 | node001.vstoragedomain_pci_0000_85_00_0 |         62 | 1f08c319-f270-<…>  | 1f08c319-f270-<…>    |
    | 94a84fc6-2f28-46d5-93e1-e588e347dd3b | node001.vstoragedomain_pci_0000_10_00_0 |         38 | 1f08c319-f270-<…>  | 1f08c319-f270-<…>    |
    | 41c177e3-6998-4e56-8d29-f98f72fef910 | node002.vstoragedomain_pci_0000_85_00_0 |         13 | 9dbc8c64-0048-<…>  | 9dbc8c64-0048-<…>    |
    | 7fd1d10f-9ceb-4cd1-acec-a1254755211b | node002.vstoragedomain_pci_0000_10_00_0 |         13 | 9dbc8c64-0048-<…>  | 9dbc8c64-0048-<…>    |
    +--------------------------------------+-----------------------------------------+------------+--------------------+----------------------+
  2. Create custom traits that correspond to different GPU types. For example, to create the traits CUSTOM_NVIDIA_231 and CUSTOM_NVIDIA_232, run:

    # openstack --insecure trait create CUSTOM_NVIDIA_231
    # openstack --insecure trait create CUSTOM_NVIDIA_232
  3. Add the corresponding trait to the resource provider matching the GPU. For example:

    # openstack --insecure resource provider trait set --trait CUSTOM_NVIDIA_231 7d2ef259-42df-4ef8-8eaa-66c3b7448fc3
    +-------------------+
    | name              |
    +-------------------+
    | CUSTOM_NVIDIA_231 |
    +-------------------+
    # openstack --insecure resource provider trait set --trait CUSTOM_NVIDIA_231 94a84fc6-2f28-46d5-93e1-e588e347dd3b
    +-------------------+
    | name              |
    +-------------------+
    | CUSTOM_NVIDIA_231 |
    +-------------------+

    Now, the trait CUSTOM_NVIDIA_231 is assigned to the vGPU resource providers of the node node001. To assign the trait CUSTOM_NVIDIA_232 to the vGPU resource providers of the node node002, run:

    # openstack --insecure resource provider trait set --trait CUSTOM_NVIDIA_232 41c177e3-6998-4e56-8d29-f98f72fef910
    +-------------------+
    | name              |
    +-------------------+
    | CUSTOM_NVIDIA_232 |
    +-------------------+
    # openstack --insecure resource provider trait set --trait CUSTOM_NVIDIA_232 7fd1d10f-9ceb-4cd1-acec-a1254755211b
    +-------------------+
    | name              |
    +-------------------+
    | CUSTOM_NVIDIA_232 |
    +-------------------+

To create virtual machines with different vGPU types

  1. Create flavors with the resources property specifying the number of vGPUs to use. For example, to create the vgpu231-flavor flavor with 2 vCPUs and 4 GiB of RAM and the vgpu232-flavor flavor with 4 vCPUs and 8 GiB of RAM, run:

    # openstack --insecure flavor create --ram 4096 --vcpus 2 --property resources:VGPU=1 --public vgpu231-flavor
    # openstack --insecure flavor create --ram 8192 --vcpus 4 --property resources:VGPU=1 --public vgpu232-flavor
  2. Add the requested traits to your flavors. For example, to add the traits CUSTOM_NVIDIA_231 and CUSTOM_NVIDIA_232 to the flavors vgpu231-flavor and vgpu232-flavor, run:

    # openstack --insecure flavor set --property trait:CUSTOM_NVIDIA_231=required vgpu231-flavor
    # openstack --insecure flavor set --property trait:CUSTOM_NVIDIA_232=required vgpu232-flavor
  3. Create virtual machines specifying the prepared flavors. For example, to create the vm vgpu231-vm with the vgpu231-flavor flavor and the vol1 volume, and the vm vgpu232-vm with the vgpu232-flavor flavor and the vol2 volume, run:

    # openstack --insecure server create --volume vol1 --flavor vgpu231-flavor vgpu231-vm
    # openstack --insecure server create --volume vol2 --flavor vgpu232-flavor vgpu232-vm

The created virtual machines will have virtual GPUs of different types that are configured in the compute cluster.