openstack-manuals/doc/config-reference/source/tables/glance-imagecache.rst

8.4 KiB

Description of flagmappings configuration options
Configuration option = Default value Description
[DEFAULT]

delayed_delete = False

(Boolean) Turn on/off delayed delete.

Typically when an image is deleted, the glance-api service puts the image into deleted state and deletes its data at the same time. Delayed delete is a feature in Glance that delays the actual deletion of image data until a later point in time (as determined by the configuration option scrub_time). When delayed delete is turned on, the glance-api service puts the image into pending_delete state upon deletion and leaves the image data in the storage backend for the image scrubber to delete at a later time. The image scrubber will move the image into deleted state upon successful deletion of image data.

NOTE: When delayed delete is turned on, image scrubber MUST be running as a periodic task to prevent the backend storage from filling up with undesired usage.

Possible values:

  • True
  • False

Related options:

  • scrub_time
  • wakeup_time
  • scrub_pool_size

image_cache_dir = None

(String) Base directory for image cache.

This is the location where image data is cached and served out of. All cached images are stored directly under this directory. This directory also contains three subdirectories, namely, incomplete, invalid and queue.

The incomplete subdirectory is the staging area for downloading images. An image is first downloaded to this directory. When the image download is successful it is moved to the base directory. However, if the download fails, the partially downloaded image file is moved to the invalid subdirectory.

The queuesubdirectory is used for queuing images for download. This is used primarily by the cache-prefetcher, which can be scheduled as a periodic task like cache-pruner and cache-cleaner, to cache images ahead of their usage. Upon receiving the request to cache an image, Glance touches a file in the queue directory with the image id as the file name. The cache-prefetcher, when running, polls for the files in queue directory and starts downloading them in the order they were created. When the download is successful, the zero-sized file is deleted from the queue directory. If the download fails, the zero-sized file remains and it'll be retried the next time cache-prefetcher runs.

Possible values:

  • A valid path

Related options:

  • image_cache_sqlite_db

image_cache_driver = sqlite

(String) The driver to use for image cache management.

This configuration option provides the flexibility to choose between the different image-cache drivers available. An image-cache driver is responsible for providing the essential functions of image-cache like write images to/read images from cache, track age and usage of cached images, provide a list of cached images, fetch size of the cache, queue images for caching and clean up the cache, etc.

The essential functions of a driver are defined in the base class glance.image_cache.drivers.base.Driver. All image-cache drivers (existing and prospective) must implement this interface. Currently available drivers are sqlite and xattr. These drivers primarily differ in the way they store the information about cached images:

  • The sqlite driver uses a sqlite database (which sits on every glance node locally) to track the usage of cached images.
  • The xattr driver uses the extended attributes of files to store this information. It also requires a filesystem that sets atime on the files when accessed.

Possible values:

  • sqlite
  • xattr

Related options:

  • None

image_cache_max_size = 10737418240

(Integer) The upper limit on cache size, in bytes, after which the cache-pruner cleans up the image cache.

NOTE: This is just a threshold for cache-pruner to act upon. It is NOT a hard limit beyond which the image cache would never grow. In fact, depending on how often the cache-pruner runs and how quickly the cache fills, the image cache can far exceed the size specified here very easily. Hence, care must be taken to appropriately schedule the cache-pruner and in setting this limit.

Glance caches an image when it is downloaded. Consequently, the size of the image cache grows over time as the number of downloads increases. To keep the cache size from becoming unmanageable, it is recommended to run the cache-pruner as a periodic task. When the cache pruner is kicked off, it compares the current size of image cache and triggers a cleanup if the image cache grew beyond the size specified here. After the cleanup, the size of cache is less than or equal to size specified here.

Possible values:

  • Any non-negative integer

Related options:

  • None

image_cache_sqlite_db = cache.db

(String) The relative path to sqlite file database that will be used for image cache management.

This is a relative path to the sqlite file database that tracks the age and usage statistics of image cache. The path is relative to image cache base directory, specified by the configuration option image_cache_dir.

This is a lightweight database with just one table.

Possible values:

  • A valid relative path to sqlite file database

Related options:

  • image_cache_dir

image_cache_stall_time = 86400

(Integer) The amount of time, in seconds, an incomplete image remains in the cache.

Incomplete images are images for which download is in progress. Please see the description of configuration option image_cache_dir for more detail. Sometimes, due to various reasons, it is possible the download may hang and the incompletely downloaded image remains in the incomplete directory. This configuration option sets a time limit on how long the incomplete images should remain in the incomplete directory before they are cleaned up. Once an incomplete image spends more time than is specified here, it'll be removed by cache-cleaner on its next run.

It is recommended to run cache-cleaner as a periodic task on the Glance API nodes to keep the incomplete images from occupying disk space.

Possible values:

  • Any non-negative integer

Related options:

  • None

scrub_pool_size = 1

(Integer) The size of thread pool to be used for scrubbing images.

When there are a large number of images to scrub, it is beneficial to scrub images in parallel so that the scrub queue stays in control and the backend storage is reclaimed in a timely fashion. This configuration option denotes the maximum number of images to be scrubbed in parallel. The default value is one, which signifies serial scrubbing. Any value above one indicates parallel scrubbing.

Possible values:

  • Any non-zero positive integer

Related options:

  • delayed_delete

scrub_time = 0

(Integer) The amount of time, in seconds, to delay image scrubbing.

When delayed delete is turned on, an image is put into pending_delete state upon deletion until the scrubber deletes its image data. Typically, soon after the image is put into pending_delete state, it is available for scrubbing. However, scrubbing can be delayed until a later point using this configuration option. This option denotes the time period an image spends in pending_delete state before it is available for scrubbing.

It is important to realize that this has storage implications. The larger the scrub_time, the longer the time to reclaim backend storage from deleted images.

Possible values:

  • Any non-negative integer

Related options:

  • delayed_delete