glance.api.common module¶
- glance.api.common.check_quota(context, image_size, db_api, image_id=None)[source]¶
Method called to see if the user is allowed to store an image.
Checks if it is allowed based on the given size in glance based on their quota and current usage.
- Parameters:
context
image_size – The size of the image we hope to store
db_api – The db_api in use for this configuration
image_id – The image that will be replaced with this new data size
- Returns:
- glance.api.common.get_remaining_quota(context, db_api, image_id=None)[source]¶
Method called to see if the user is allowed to store an image.
Checks if it is allowed based on the given size in glance based on their quota and current usage.
- Parameters:
context
db_api – The db_api in use for this configuration
image_id – The image that will be replaced with this new data size
- Returns:
The number of bytes the user has remaining under their quota. None means infinity
- glance.api.common.get_thread_pool(lock_name, size=None)[source]¶
Initializes thread pool.
If thread pool is present in cache, then returns it from cache else create new pool, stores it in cache and return newly created pool.
@param lock_name: Name of the lock. @param size: Size of pool.
@return: ThreadPoolModel