# openstack.compute.v2.usage

## The Usage Class

The `Usage` class inherits from `Resource`.

class openstack.compute.v2.usage.Usage(_synchronized=False, connection=None, **attrs)

  The base resource

  Parameters:

    - _synchronized (bool) – This is not intended to be used directly. See `new()` and `existing()`.

    - connection (openstack.connection.Connection) – Reference to the Connection being used. Defaults to None to allow Resource objects to be used without an active Connection, such as in unit tests. Use of `self._connection` in Resource code should protect itself with a check for None.

  resource_key = 'tenant_usage'

    Singular form of key for resource.

  resources_key = 'tenant_usages'

    Plural form of key for resource.

  base_path = '/os-simple-tenant-usage'

    The base part of the URI for this resource.

  allow_create = False

    Allow create operation for this resource.

  allow_fetch = True

    Allow get operation for this resource.

  allow_delete = False

    Allow delete operation for this resource.

  allow_list = True

    Allow list operation for this resource.

  allow_commit = False

    Allow update operation for this resource.

  project_id

    The UUID of the project in a multi-tenancy cloud.

  server_usages

    A list of the server usage objects.

  total_local_gb_usage

    Multiplying the server disk size (in GiB) by hours the server exists, and then adding that all together for each server.

  total_vcpus_usage

    Multiplying the number of virtual CPUs of the server by hours the server exists, and then adding that all together for each server.

  total_memory_mb_usage

    Multiplying the server memory size (in MiB) by hours the server exists, and then adding that all together for each server.

  total_hours

    The total duration that servers exist (in hours).

  start

    The beginning time to calculate usage statistics on compute and storage resources.

  stop

    The ending time to calculate usage statistics on compute and storage resources.

## The ServerUsage Class

The `ServerUsage` class inherits from `Resource`.

class openstack.compute.v2.usage.ServerUsage(_synchronized=False, connection=None, **attrs)

  The base resource

  Parameters:

    - _synchronized (bool) – This is not intended to be used directly. See `new()` and `existing()`.

    - connection (openstack.connection.Connection) – Reference to the Connection being used. Defaults to None to allow Resource objects to be used without an active Connection, such as in unit tests. Use of `self._connection` in Resource code should protect itself with a check for None.

  resource_key = None

    Singular form of key for resource.

  resources_key = None

    Plural form of key for resource.

  allow_create = False

    Allow create operation for this resource.

  allow_fetch = False

    Allow get operation for this resource.

  allow_delete = False

    Allow delete operation for this resource.

  allow_list = False

    Allow list operation for this resource.

  allow_commit = False

    Allow update operation for this resource.

  hours

    The duration that the server exists (in hours).

  flavor

    The display name of a flavor.

  instance_id

    The UUID of the server.

  name

    The server name.

  project_id

    The UUID of the project in a multi-tenancy cloud.

  memory_mb

    The memory size of the server (in MiB).

  local_gb

    The sum of the root disk size of the server and the ephemeral disk size of it (in GiB).

  vcpus

    The number of virtual CPUs that the server uses.

  started_at

    The date and time when the server was launched.

  ended_at

    The date and time when the server was deleted.

  state

    The VM state.

  uptime

    The uptime of the server.

this page last updated: 2026-01-16 23:06:19

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.