Configuring GPU metering
In addition to built-in compute metrics, GPU usage can also be measured for billing and reporting purposes.
GPU resources differ from standard compute resources because GPU metrics are not created automatically. After configuring GPU passthrough or vGPU on compute nodes, you need to create GPU metrics and associate them with GPU aliases.
GPU billing is based on the following model:
- GPU passthrough or vGPU aliases are discovered on compute nodes.
- GPU metrics are created.
- One or more GPU aliases are associated with each metric.
- GPU-based flavors are created using these aliases.
- Virtual machines are provisioned from these flavors.
- Ceilometer periodically polls virtual machines and calculates GPU allocation per project.
GPU usage is aggregated per project and per GPU metric across all virtual machines and compute nodes in the cluster.
GPU metrics are gauge metrics sampled at regular intervals (typically every five minutes). Each sample represents the number of GPUs allocated to a project for a specific GPU metric at the time of polling.
GPU usage data is stored in Gnocchi and can be queried in the same way as other compute metrics.
Limitations
- GPU allocation is accounted for all virtual machines with attached GPUs except for shelved virtual machines, because their resources are released when the VM is shelved.