Implementation of SQLAlchemy backend.
Ensures a request has permission to access the given project.
Ensures a request has permission to access the given quota class.
Ensures a request has permission to access the given user.
Return a filter to check if a CG is being used as creation source.
Returned filter is meant to be used in the Conditional Update mechanism and checks if provided CG ID or CG Snapshot ID is currently being used to create another CG.
This filter will not include CGs that have used the ID but have already finished their creation (status is no longer creating).
Filter uses a subquery that allows it to be used on updates to the consistencygroups table.
Return a filter that checks if a CG has CG Snapshots.
Return a filter to check if a CG has volumes.
When attached_or_with_snapshots parameter is given a True value only attached volumes or those with snapshots will be considered.
Get a filter that checks if a CGSnapshot is being created from a CG.
Create matching filter.
If value is an iterable other than a string, any of the values is a valid match (OR), so we’ll use SQL IN operator.
If it’s not an iterator == operator will be used.
Create non matching filter.
If value is an iterable other than a string, any of the values is a valid match (OR), so we’ll use SQL IN operator.
If it’s not an iterator == operator will be used.
If auto_none is True then we’ll consider NULL values as different as well, like we do in Python and not like SQL does.
The backend is this module itself.
Get a filter to check if a grp snapshot is being created from a grp.
Indicates if the request context is an administrator.
Check if object is an ORM field or expression.
Indicates if the request context is a normal user.
Return True if filter values exist on the model
Parameters: |
|
---|
Query helper that accounts for context’s read_deleted field.
Parameters: |
|
---|
Process the sort parameters to include default keys.
Creates a list of sort keys and a list of sort directions. Adds the default keys to the end of the list if they are not already included.
When adding the default keys to the sort keys list, the associated direction is: 1) The first element in the ‘sort_dirs’ list (if specified), else 2) ‘default_dir’ value (Note that ‘asc’ is the default value since this is the default in sqlalchemy.utils.paginate_query)
Parameters: |
|
---|---|
Returns: | list of sort keys, list of sort directions |
Raises exception.InvalidInput: | |
If more sort directions than sort keys are specified or if an invalid sort direction is specified |
Destroy all limit quotas associated with a project.
Leaves usage and reservation quotas intact.
Decorator to require admin request context.
The first argument to the wrapped function must be the context.
Decorator to require any user or admin context.
This does no authorization for user or project access matching, see authorize_project_context() and authorize_user_context().
The first argument to the wrapped function must be the context.
Decorator to require the specified snapshot to exist.
Requires the wrapped function to use context and snapshot_id as their first two arguments.
Decorator to require the specified volume to exist.
Requires the wrapped function to use context and volume_id as their first two arguments.
Filter to check that qos allows retyping the volume to new_vol_type.
Returned sqlalchemy filter will evaluate to True when volume’s status is available or when it’s ‘in-use’ but the qos in new_vol_type is the same as the qos of the volume or when it doesn’t exist a consumer spec key that specifies anything other than the back-end in any of the 2 volume_types.
Update volume status based on attachment.
Get volume and check if ‘volume_attachment’ parameter is present in volume. If ‘volume_attachment’ is None then set volume status to ‘available’ else set volume status to ‘in-use’.
Parameters: |
|
---|---|
Returns: | updated volume |
Claim a worker entry for cleanup.
Create a worker entry from optional arguments.
Delete a worker (no soft delete).
Get a worker or raise exception if it does not exist.
Get all workers that match given criteria.
Update a worker with given values.