neutron_lib.db.quota_api module

class neutron_lib.db.quota_api.QuotaDriverAPI

Bases: object

abstract static cancel_reservation(context, reservation_id)

Cancel a reservation register

Parameters:
  • context – The request context, for access checks.

  • reservation_id – ID of the reservation register to cancel.

abstract static commit_reservation(context, reservation_id)

Commit a reservation register

Parameters:
  • context – The request context, for access checks.

  • reservation_id – ID of the reservation register to commit.

abstract static delete_project_quota(context, project_id)

Delete the quota entries for a given project_id.

After deletion, this project will use default quota values in conf. Raise a “not found” error if the quota for the given project was never defined.

Parameters:
  • context – The request context, for access checks.

  • project_id – The ID of the project to return quotas for.

abstract static get_all_quotas(context, resources)

Given a list of resources, retrieve the quotas for the all tenants.

Parameters:
  • context – The request context, for access checks.

  • resources – A dictionary of the registered resource keys.

Returns:

quotas list of dict of project_id:, resourcekey1: resourcekey2: …

abstract static get_default_quotas(context, resources, project_id)

Retrieve the default quotas for the list of resources and project.

Parameters:
  • context – The request context, for access checks.

  • resources – A dictionary of the registered resource keys.

  • project_id – The ID of the project to return default quotas for.

Returns:

dict from resource name to dict of name and limit

abstract static get_detailed_project_quotas(context, resources, project_id)

Retrieve detailed quotas for the given list of resources and project

Parameters:
  • context – The request context, for access checks.

  • resources – A dictionary of the registered resource keys.

  • project_id – The ID of the project to return quotas for.

Return dict:

mapping resource name in dict to its corresponding limit used and reserved. Reserved currently returns default value of 0

abstract static get_project_quotas(context, resources, project_id)

Retrieve the quotas for the given list of resources and project

Parameters:
  • context – The request context, for access checks.

  • resources – A dictionary of the registered resource keys.

  • project_id – The ID of the project to return quotas for.

Returns:

dict from resource name to dict of name and limit

abstract static get_resource_usage(context, project_id, resources, resource_name)

Return the resource current usage

Parameters:
  • context – The request context, for access checks.

  • project_id – The ID of the project to make the reservations for.

  • resources – A dictionary of the registered resources.

  • resource_name – The name of the resource to retrieve the usage.

Returns:

The current resource usage.

abstract static get_workers()

Return the quota driver workers to be spawned during initialization

This method returns the quota driver workers that needs to be spawned during the plugin initialization. For example, DbQuotaNoLockDriver requires a PeriodicWorker to clean up the expired reservations left in the database.

Returns:

list of worker.BaseWorker or derived instances.

abstract static limit_check(context, project_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.

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.

  • project_id – The ID of the project to make the reservations for.

  • resources – A dictionary of the registered resource.

  • values – A dictionary of the values to check against the quota.

abstract static make_reservation(context, project_id, resources, deltas, plugin)

Make multiple resource reservations for a given project

Parameters:
  • context – The request context, for access checks.

  • resources – A dictionary of the registered resource keys.

  • project_id – The ID of the project to make the reservations for.

Returns:

ReservationInfo object.

abstract static quota_limit_check(context, project_id, resources, deltas)

Check the current resource usage against a set of deltas.

This method will check if the provided resource deltas could be assigned depending on the current resource usage and the quota limits. If the resource deltas plus the resource usage fit under the quota limit, the method will pass. If not, a OverQuota will be raised.

Parameters:
  • context – The request context, for access checks.

  • project_id – The ID of the project to make the reservations for.

  • resources – A dictionary of the registered resource.

  • deltas – A dictionary of the values to check against the quota limits.

Returns:

None if passed; OverQuota if quota limits are exceeded, InvalidQuotaValue if delta values are invalid.

abstract static update_quota_limit(context, project_id, resource, limit)

Update the quota limit for a resource in a project

Parameters:
  • context – The request context, for access checks.

  • project_id – The ID of the project to update the quota.

  • resource – the resource to update the quota.

  • limit – new resource quota limit.