cinder.api.api_utils module

class GenericProjectInfo(project_id: str, project_keystone_api_version: str, domain_id: str | None = None, name: str | None = None, description: str | None = None)

Bases: object

Abstraction layer for Keystone V2 and V3 project objects

add_visible_admin_metadata(volume) None

Add user-visible admin metadata to regular metadata.

Extracts the admin metadata keys that are to be made visible to non-administrators, and adds them to the regular metadata structure for the passed-in volume.

get_project(context: context.RequestContext, project_id: str) GenericProjectInfo

Method to verify project exists in keystone

is_none_string(val: Any) bool

Check if a string represents a None value.

remove_invalid_filter_options(context: context.RequestContext, filters: dict, allowed_search_options: Iterable[str]) None

Remove search options that are not valid for non-admin API/context.

validate_integer(value: int, name: str, min_value: int | None = None, max_value: int | None = None) int

Make sure that value is a valid integer, potentially within range.

Parameters:
  • value – the value of the integer

  • name – the name of the integer

  • min_value – the min value of the integer

  • max_value – the max value of the integer

Returns:

integer

validate_project_and_authorize(context: context.RequestContext, project_id: str, policy_check: str, validate_only: bool = False) None
walk_class_hierarchy(clazz: type, encountered: list[type] | None = None) Generator[type, None, None]

Walk class hierarchy, yielding most derived classes first.