Use dogpile.cache.memcached in nova caching

According to the latest keystone configuration help,
dogpile.cache.memcached is more recommended option in TripleO
deployment than oslo_cache.memcache_pool, because it uses httpd+wsgi
to run apis and has less than 100 threaded servers.

This patch replaces backend used in nova caching, and also introduces
the new parameter tripleo::profile::base::nova::cache_backend so that
operators can use another backend if they want.

Change-Id: I36c0c474fb5e665392c1fb8d93dc3949ab6e8b67
(cherry picked from commit 8d4ea840bf)
This commit is contained in:
Takashi Kajinami 2020-03-28 15:46:08 +09:00 committed by Grzegorz Grasza
parent 44b64a167b
commit 8d3ea85a36
2 changed files with 8 additions and 3 deletions

View File

@ -86,7 +86,11 @@
# (Optional) Enable the use of cache. Note that it is unsupported # (Optional) Enable the use of cache. Note that it is unsupported
# to disable this key. It is only useful for debugging purposes. # to disable this key. It is only useful for debugging purposes.
# Defaults to true # Defaults to true
#
# [*cache_backend*]
# (Optional) Backend implementation to store cache
# Defaults to 'dogpile.cache.memcached'
#
class tripleo::profile::base::nova ( class tripleo::profile::base::nova (
$bootstrap_node = hiera('nova_api_short_bootstrap_node_name', undef), $bootstrap_node = hiera('nova_api_short_bootstrap_node_name', undef),
$oslomsg_rpc_proto = hiera('oslo_messaging_rpc_scheme', 'rabbit'), $oslomsg_rpc_proto = hiera('oslo_messaging_rpc_scheme', 'rabbit'),
@ -105,6 +109,7 @@ class tripleo::profile::base::nova (
$memcached_ips = hiera('memcached_node_ips', []), $memcached_ips = hiera('memcached_node_ips', []),
$memcached_port = hiera('memcached_port', 11211), $memcached_port = hiera('memcached_port', 11211),
$enable_cache = true, $enable_cache = true,
$cache_backend = 'dogpile.cache.memcached',
) { ) {
if $bootstrap_node and $::hostname == downcase($bootstrap_node) { if $bootstrap_node and $::hostname == downcase($bootstrap_node) {
@ -131,7 +136,7 @@ class tripleo::profile::base::nova (
include ::nova::logging include ::nova::logging
class { '::nova::cache': class { '::nova::cache':
enabled => $enable_cache, enabled => $enable_cache,
backend => 'oslo_cache.memcache_pool', backend => $cache_backend,
memcache_servers => $memcache_servers, memcache_servers => $memcache_servers,
} }
class { '::nova': class { '::nova':

View File

@ -55,7 +55,7 @@ describe 'tripleo::profile::base::nova' do
is_expected.to contain_class('nova::logging') is_expected.to contain_class('nova::logging')
is_expected.to contain_class('nova::cache').with( is_expected.to contain_class('nova::cache').with(
:enabled => true, :enabled => true,
:backend => 'oslo_cache.memcache_pool', :backend => 'dogpile.cache.memcached',
:memcache_servers => ['127.0.0.1:11211'] :memcache_servers => ['127.0.0.1:11211']
) )
is_expected.to contain_class('nova::placement') is_expected.to contain_class('nova::placement')