diff --git a/nova/cache_utils.py b/nova/cache_utils.py index bc0851c4cb..e764738a51 100644 --- a/nova/cache_utils.py +++ b/nova/cache_utils.py @@ -14,24 +14,32 @@ # License for the specific language governing permissions and limitations # under the License. -"""Super simple fake memcache client.""" +"""Simple wrapper for oslo_cache.""" from oslo_cache import core as cache +from oslo_log import log as logging import nova.conf -from nova.i18n import _ - +from nova.i18n import _, _LW CONF = nova.conf.CONF +LOG = logging.getLogger(__name__) + WEEK = 604800 +def _warn_if_null_backend(): + if CONF.cache.backend == 'dogpile.cache.null': + LOG.warning(_LW("Cache enabled with backend dogpile.cache.null.")) + + def get_memcached_client(expiration_time=0): """Used ONLY when memcached is explicitly needed.""" # If the operator has [cache]/enabled flag on then we let oslo_cache # configure the region from the configuration settings if CONF.cache.enabled and CONF.cache.memcache_servers: + _warn_if_null_backend() return CacheClient( _get_default_cache_region(expiration_time=expiration_time)) @@ -41,6 +49,7 @@ def get_client(expiration_time=0): # If the operator has [cache]/enabled flag on then we let oslo_cache # configure the region from configuration settings. if CONF.cache.enabled: + _warn_if_null_backend() return CacheClient( _get_default_cache_region(expiration_time=expiration_time)) # If [cache]/enabled flag is off, we use the dictionary backend diff --git a/releasenotes/notes/switch-to-oslo-cache-7114a0ab2dea52df.yaml b/releasenotes/notes/switch-to-oslo-cache-7114a0ab2dea52df.yaml index 2cc24234da..509664eb98 100644 --- a/releasenotes/notes/switch-to-oslo-cache-7114a0ab2dea52df.yaml +++ b/releasenotes/notes/switch-to-oslo-cache-7114a0ab2dea52df.yaml @@ -5,5 +5,6 @@ deprecations: - Option ``memcached_servers`` is deprecated in Mitaka. Operators should use oslo.cache configuration instead. Specifically ``enabled`` option - under [cache] section should be set to True and the url(s) for the - memcached servers should be in [cache]/memcache_servers option. \ No newline at end of file + under [cache] section should be set to True, the ``backend`` option to + ``oslo_cache.memcache_pool`` and the location(s) of the + memcached servers should be in [cache]/memcache_servers option.