Skip to main content

Get VM State Counts

GET
/projects/:projectId/vms/state-counts

Returns the number of virtual machines in the project, broken down by lifecycle status and by power state.

Use this instead of counting a paged VM list on the client: the counts are computed server-side and stay accurate no matter how many VMs the project has. total is the number of VMs in the project. The response also has two breakdowns. byStatus reports the number of VMs in each lifecycle status; every status is always present (a status with no VMs is 0), the fields sum to the project's total VM count, and each field equals the number of VMs the list endpoint returns for the matching status== filter on the same data. byPowerState reports running/stopped counts; VMs that do not have a power state yet (still being created) are excluded, so its fields can sum to less than the total. The counts are not cached, so two calls made while VMs are changing may differ.

Request

Responses

The VM state counts for the project.