13.2.2. Designating Compute nodes for vGPU

To designate Compute nodes for vGPU workloads, you must create a new role file to configure the vGPU role, and configure a new overcloud flavor and resource class to use to tag the GPU-enabled Compute nodes.


  1. Log in to the undercloud as the stack user.
  2. Source the stackrc file:

    [stack@director ~]$ source ~/stackrc
  3. Generate a new roles data file named roles_data_gpu.yaml that includes the Controller, Compute, and ComputeGpu roles:

    (undercloud)$ openstack overcloud roles \
      generate -o /home/stack/templates/roles_data_gpu.yaml \
      Compute:ComputeGpu Compute Controller
  4. Open roles_data_gpu.yaml and edit or add the following parameters and sections:

    Section/ParameterCurrent valueNew value

    Role comment

    Role: Compute

    Role: ComputeGpu

    Role name

    name: Compute

    name: ComputeGpu


    Basic Compute Node role

    GPU Compute Node role










  5. Register the GPU-enabled Compute nodes for the overcloud by adding them to your node definition template, node.json or node.yaml. For more information, see Registering nodes for the overcloud in the Director Installation and Usage guide.
  6. Inspect the node hardware:

    (undercloud)$ openstack overcloud node introspect --all-manageable \

    For more information, see the relevant section in the Director Installation and Usage guide:

  7. Create the compute-vgpu-nvidia overcloud flavor for vGPU Compute nodes:

    (undercloud)$ openstack flavor create --id auto \
      --ram <ram_size_mb> --disk <disk_size_gb> \
      --vcpus <no_vcpus> compute-vgpu-nvidia
    • Replace <ram_size_mb> with the RAM of the bare metal node, in MB.
    • Replace <disk_size_gb> with the size of the disk on the bare metal node, in GB.
    • Replace <no_vcpus> with the number of CPUs on the bare metal node.


      These properties are not used for scheduling instances. However, the Compute scheduler does use the disk size to determine the root partition size.

  8. Tag each bare metal node that you want to designate for GPU workloads with a custom GPU resource class:

    (undercloud)$ openstack baremetal node set \
     --resource-class baremetal.GPU <node>

    Replace <node> with the ID of the baremetal node.

  9. Associate the compute-vgpu-nvidia flavor with the custom GPU resource class:

    (undercloud)$ openstack flavor set \
     --property resources:CUSTOM_BAREMETAL_GPU=1 \

    To determine the name of a custom resource class that corresponds to a resource class of a Bare Metal service node, convert the resource class to uppercase, replace all punctuation with an underscore, and prefix with CUSTOM_.


    A flavor can request only one instance of a bare metal resource class.

  10. Set the following flavor properties to prevent the Compute scheduler from using the bare metal flavor properties to schedule instances:

    (undercloud)$ openstack flavor set \
     --property resources:VCPU=0 --property resources:MEMORY_MB=0 \
     --property resources:DISK_GB=0 compute-vgpu-nvidia
  11. To verify that the role was created, enter the following command:

    (undercloud)$ openstack overcloud profiles list