This Page

The quantum.quota Module

Quotas for instances, volumes, and floating ips.

class quantum.quota.BaseResource(name, flag)

Bases: object

Describe a single resource for quota checking.

default

Return the default value of the quota.

class quantum.quota.ConfDriver

Bases: object

Driver to perform necessary checks to enforce quotas and obtain quota information. The default driver utilizes the default values in quantum.conf.

static delete_tenant_quota(context, tenant_id)
static get_all_quotas(context, resources)
static get_tenant_quotas(context, resources, tenant_id)
limit_check(context, tenant_id, resources, values)

Check simple quota limits.

For limits–those quotas for which there is no usage synchronization function–this method checks that a set of proposed values are permitted by the limit restriction.

This method will raise a QuotaResourceUnknown exception if a given resource is unknown or if it is not a simple limit resource.

If any of the proposed values is over the defined quota, an OverQuota exception will be raised with the sorted list of the resources which are too high. Otherwise, the method returns nothing.

Parameters:
  • context – The request context, for access checks.
  • tennant_id – The tenant_id to check quota.
  • resources – A dictionary of the registered resources.
  • values – A dictionary of the values to check against the quota.
static update_quota_limit(context, tenant_id, resource, limit)
class quantum.quota.CountableResource(name, count, flag=None)

Bases: quantum.quota.BaseResource

Describe a resource where the counts are determined by a function.

class quantum.quota.QuotaEngine(quota_driver_class=None)

Bases: object

Represent the set of recognized quotas.

count(context, resource, *args, **kwargs)

Count a resource.

For countable resources, invokes the count() function and returns its result. Arguments following the context and resource are passed directly to the count function declared by the resource.

Parameters:
  • context – The request context, for access checks.
  • resource – The name of the resource, as a string.
limit_check(context, tenant_id, **values)

Check simple quota limits.

For limits–those quotas for which there is no usage synchronization function–this method checks that a set of proposed values are permitted by the limit restriction. The values to check are given as keyword arguments, where the key identifies the specific quota limit to check, and the value is the proposed value.

This method will raise a QuotaResourceUnknown exception if a given resource is unknown or if it is not a simple limit resource.

If any of the proposed values is over the defined quota, an OverQuota exception will be raised with the sorted list of the resources which are too high. Otherwise, the method returns nothing.

Parameters:context – The request context, for access checks.
register_resource(resource)

Register a resource.

register_resource_by_name(resourcename)

Register a resource by name.

register_resources(resources)

Register a list of resources.

resources
quantum.quota.register_resources_from_config()