← Back to team overview

openstack team mailing list archive

Re: When & how are glance-cache* (.conf, -paste.ini) files loaded / parsed ?

 


> Yes, it does make perfect sense. Kind thanks for the explanation.
> 
> However, what is still unclear is what config iteems that pertain to
> other apps must still be present (ie. duplicated in) glance-api.conf
> (e.g. image_cache_driver , etc )


This is probably something we should document more carefully so it's clear
to users from the outset which config options are required and when. 

However I don't have a definitive mapping of config items to apps, so I'd
normally consider them on a case-by-case basis and just check where the config
option is used. For example it may be always required by a particular app, or
only be required if a particular middleware is enabled.

In this particular case, a little grep'ing in the codebase soon reveals when
the image_cache_driver config item is required. 

$ find glance -name "*.py" | grep -v test | xargs grep -n -B 5 image_cache_driver
glance/image_cache/__init__.py-33-class ImageCache(object):
glance/image_cache/__init__.py-34-
glance/image_cache/__init__.py-35-    """Provides an LRU cache for image data."""
glance/image_cache/__init__.py-36-
glance/image_cache/__init__.py-37-    opts = [
glance/image_cache/__init__.py:38:        cfg.StrOpt('image_cache_driver', default='sqlite'),
--
glance/image_cache/__init__.py-48-
glance/image_cache/__init__.py-49-    def init_driver(self):
glance/image_cache/__init__.py-50-        """
glance/image_cache/__init__.py-51-        Create the driver for the cache
glance/image_cache/__init__.py-52-        """
glance/image_cache/__init__.py:53:        driver_name = self.conf.image_cache_driver

So we see that this config option is pulled in by the glance.image_cache.ImageCache
class, which is then used as follows:

$ find glance -name "*.py"  | grep -v test | xargs grep ImageCache | cut -f1 -d: | sort | uniq
glance/api/cached_images.py
glance/api/middleware/cache.py
glance/image_cache/cleaner.py
glance/image_cache/__init__.py
glance/image_cache/prefetcher.py
glance/image_cache/pruner.py
glance/image_cache/queue_image.py

Looking the first two source files, we see that the image_cache_driver config option
would be required in the glance-api application iff a caching or cachemanagement-based
pipeline is selected.

Cheers,
Eoghan


Follow ups

References