Creating virtual machines with physical GPU

  1. Connect to the OpenStack command-line interface as a system administrator to authorize further OpenStack commands (refer to Connecting to OpenStack command-line interface).

    # kolla-ansible post-deploy
    # source /etc/kolla/admin-openrc.sh
  2. Create a flavor with the pci_passthrough property specifying the GPU alias from the pci-passthrough.yaml file and the number of GPUs to use. For example, to create the gpu-flavor flavor with 8 vCPUs and 16 GiB of RAM, run:

    # openstack --insecure flavor create --ram 16 --vcpus 8 --property "pci_passthrough:alias"="gpu:1" gpu-flavor
  3. Some drivers may require to hide the hypervisor signature. To do this, add the hide_hypervisor_id property to the flavor:

    # openstack --insecure flavor set gpu-flavor --property hide_hypervisor_id=true
  4. Create a virtual machine specifying the gpu-flavor flavor. For example, to create the gpu-vm from the vol2 volume, run:

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