Creating virtual machines with virtual GPUs

Limitations

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

Prerequisites

To create a virtual machine with any vGPU enabled on a node

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

    # openstack --insecure flavor create --ram 4096 --vcpus 2 --property resources:VGPU=1 --public vgpu-flavor
  2. Create a virtual machine specifying the vgpu-flavor flavor. For example, to create the vgpu-vm from the vol2 volume, run:

    # openstack --insecure server create --volume vol2 --flavor vgpu-flavor vgpu-vm

The created virtual machine will have a virtual GPU of a randomly chosen vGPU type that is enabled on the host.

To create a virtual machine with a vGPU of a particular type

  1. Create a flavor with the resources and trait properties specifying the number of vGPUs and the vGPU type to use. For example, to create the vgpu228-flavor flavor with 2 vCPUs, 4 GiB of RAM, and the nvidia-228 vGPU type, run:

    # openstack --insecure flavor create --ram 4096 --vcpus 2 --property resources:VGPU=1 \
    --property trait:CUSTOM_NVIDIA_228=required --public vgpu228-flavor
  2. Create a virtual machine specifying the vgpu228-flavor flavor. For example, to create the vgpu-vm from the vol2 volume, run:

    # openstack --insecure server create --volume vol2 --flavor vgpu228-flavor vgpu-vm

The created virtual machine will have a virtual GPU of the nvidia-228 vGPU type.