oslo_limit.limit module

class oslo_limit.limit.Enforcer(usage_callback)

Bases: object

enforce(project_id, deltas)

Check resource usage against limits for resources in deltas

From the deltas we extract the list of resource types that need to have limits enforced on them.

From keystone we fetch limits relating to this project_id and the endpoint specified in the configuration.

Using the usage_callback specified when creating the enforcer, we fetch the existing usage.

We then add the existing usage to the provided deltas to get the total proposed usage. This total proposed usage is then compared against all appropriate limits that apply.

Note if there are no registered limits for a given resource type, we fail the enforce in the same way as if we defaulted to a limit of zero, i.e. do not allow any use of a resource type that does not have a registered limit.

  • project_id (string) – The project to check usage and enforce limits against.

  • deltas (dictionary) – An dictionary containing resource names as keys and requests resource quantities as positive integers. We only check limits for resources in deltas. Specify a quantity of zero to check current usage.


exception.ClaimExceedsLimit – when over limits