The cinder.quota_utils Module

class GenericProjectInfo(project_id, project_keystone_api_version, project_parent_id=None, project_subtree=None, project_parent_tree=None, is_admin_project=False)

Bases: object

Abstraction layer for Keystone V2 and V3 project objects

get_all_projects(context)
get_all_root_project_ids(context)
get_parent_project_id(context, project_id)
get_project_hierarchy(context, project_id, subtree_as_ids=False, parents_as_ids=False, is_admin_project=False)

A Helper method to get the project hierarchy.

Along with hierarchical multitenancy in keystone API v3, projects can be hierarchically organized. Therefore, we need to know the project hierarchy, if any, in order to do nested quota operations properly. If the domain is being used as the top most parent, it is filtered out from the parent tree and parent_id.

get_volume_type_reservation(ctxt, volume, type_id, reserve_vol_type_only=False)
update_alloc_to_next_hard_limit(context, resources, deltas, res, expire, project_id)
validate_setup_for_nested_quota_use(ctxt, resources, nested_quota_driver, fix_allocated_quotas=False)

Validates the setup supports using nested quotas.

Ensures that Keystone v3 or greater is being used, that the current user is of the cloud admin role, and that the existing quotas make sense to nest in the current hierarchy (e.g. that no child quota would be larger than it’s parent).

Parameters:
  • resources – the quota resources to validate
  • nested_quota_driver – nested quota driver used to validate each tree
  • fix_allocated_quotas – if True, parent projects “allocated” total will be calculated based on the existing child limits and the DB will be updated. If False, an exception is raised reporting any parent allocated quotas are currently incorrect.

Previous topic

The cinder.quota Module

Next topic

The cinder.replication.api Module

Project Source

This Page