# glance.api.common module

glance.api.common.check_quota(context, image_size, db_api, image_id=None)

  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)

  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)

  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

glance.api.common.image_send_notification(bytes_written, expected_size, image_meta, request, notifier)

  Send an image.send message to the notifier.

glance.api.common.memoize(lock_name)

glance.api.common.size_checked_iter(response, image_meta, expected_size, image_iter, notifier)

this page last updated: 2026-03-19 01:38:33

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.

found an error? report a bug