Merge "Add socket keepalive options for the pymemcache backend"

This commit is contained in:
Zuul 2022-01-28 22:08:58 +00:00 committed by Gerrit Code Review
commit 0b751f669c
3 changed files with 70 additions and 24 deletions

View File

@ -138,6 +138,28 @@
# (Optional) A list of memcached server(s) to use for caching. (list value) # (Optional) A list of memcached server(s) to use for caching. (list value)
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*cache_enable_socket_keepalive*]
# (Optional) Global toggle for the socket keepalive of dogpile's
# pymemcache backend
# Defaults to $::os_service_default
#
# [*cache_socket_keepalive_idle*]
# (Optional) The time (in seconds) the connection needs to remain idle
# before TCP starts sending keepalive probes. Should be a positive integer
# most greater than zero.
# Defaults to $::os_service_default
#
# [*cache_socket_keepalive_interval*]
# (Optional) The time (in seconds) between individual keepalive probes.
# Should be a positive integer most greater than zero.
# Defaults to $::os_service_default
#
# [*cache_socket_keepalive_count*]
# (Optional) The maximum number of keepalive probes TCP should send before
# dropping the connection. Should be a positive integer most greater than
# zero.
# Defaults to $::os_service_default
#
# [*cache_tls_enabled*] # [*cache_tls_enabled*]
# (Optional) Global toggle for TLS usage when comunicating with # (Optional) Global toggle for TLS usage when comunicating with
# the caching servers. # the caching servers.
@ -295,6 +317,10 @@ class ceilometer(
$kombu_compression = $::os_service_default, $kombu_compression = $::os_service_default,
$cache_backend = $::os_service_default, $cache_backend = $::os_service_default,
$memcache_servers = $::os_service_default, $memcache_servers = $::os_service_default,
$cache_enable_socket_keepalive = $::os_service_default,
$cache_socket_keepalive_idle = $::os_service_default,
$cache_socket_keepalive_interval = $::os_service_default,
$cache_socket_keepalive_count = $::os_service_default,
$cache_tls_enabled = $::os_service_default, $cache_tls_enabled = $::os_service_default,
$cache_tls_cafile = $::os_service_default, $cache_tls_cafile = $::os_service_default,
$cache_tls_certfile = $::os_service_default, $cache_tls_certfile = $::os_service_default,
@ -419,13 +445,17 @@ will be removed in a future release.')
} }
oslo::cache { 'ceilometer_config': oslo::cache { 'ceilometer_config':
backend => $cache_backend, backend => $cache_backend,
memcache_servers => $memcache_servers, memcache_servers => $memcache_servers,
tls_enabled => $cache_tls_enabled, enable_socket_keepalive => $cache_enable_socket_keepalive,
tls_cafile => $cache_tls_cafile, socket_keepalive_idle => $cache_socket_keepalive_idle,
tls_certfile => $cache_tls_certfile, socket_keepalive_interval => $cache_socket_keepalive_interval,
tls_keyfile => $cache_tls_keyfile, socket_keepalive_count => $cache_socket_keepalive_count,
tls_allowed_ciphers => $cache_tls_allowed_ciphers, tls_enabled => $cache_tls_enabled,
manage_backend_package => $manage_backend_package, tls_cafile => $cache_tls_cafile,
tls_certfile => $cache_tls_certfile,
tls_keyfile => $cache_tls_keyfile,
tls_allowed_ciphers => $cache_tls_allowed_ciphers,
manage_backend_package => $manage_backend_package,
} }
} }

View File

@ -0,0 +1,4 @@
---
features:
- |
Add socket keepalive options for the pymemcache (dogpile.cache) backend.

View File

@ -125,14 +125,18 @@ describe 'ceilometer' do
it 'configures cache backend' do it 'configures cache backend' do
is_expected.to contain_oslo__cache('ceilometer_config').with( is_expected.to contain_oslo__cache('ceilometer_config').with(
:backend => '<SERVICE DEFAULT>', :backend => '<SERVICE DEFAULT>',
:memcache_servers => '<SERVICE DEFAULT>', :memcache_servers => '<SERVICE DEFAULT>',
:tls_enabled => '<SERVICE DEFAULT>', :enable_socket_keepalive => '<SERVICE DEFAULT>',
:tls_cafile => '<SERVICE DEFAULT>', :socket_keepalive_idle => '<SERVICE DEFAULT>',
:tls_certfile => '<SERVICE DEFAULT>', :socket_keepalive_interval => '<SERVICE DEFAULT>',
:tls_keyfile => '<SERVICE DEFAULT>', :socket_keepalive_count => '<SERVICE DEFAULT>',
:tls_allowed_ciphers => '<SERVICE DEFAULT>', :tls_enabled => '<SERVICE DEFAULT>',
:manage_backend_package => true, :tls_cafile => '<SERVICE DEFAULT>',
:tls_certfile => '<SERVICE DEFAULT>',
:tls_keyfile => '<SERVICE DEFAULT>',
:tls_allowed_ciphers => '<SERVICE DEFAULT>',
:manage_backend_package => true,
) )
end end
@ -164,19 +168,27 @@ describe 'ceilometer' do
context 'with overridden cache parameter' do context 'with overridden cache parameter' do
before { before {
params.merge!( params.merge!(
:cache_backend => 'memcache', :cache_backend => 'memcache',
:memcache_servers => 'host1:11211,host2:11211', :memcache_servers => 'host1:11211,host2:11211',
:cache_tls_enabled => true, :cache_enable_socket_keepalive => false,
:manage_backend_package => false, :cache_socket_keepalive_idle => 1,
:cache_socket_keepalive_interval => 1,
:cache_socket_keepalive_count => 1,
:cache_tls_enabled => true,
:manage_backend_package => false,
) )
} }
it 'configures cache backend' do it 'configures cache backend' do
is_expected.to contain_oslo__cache('ceilometer_config').with( is_expected.to contain_oslo__cache('ceilometer_config').with(
:backend => 'memcache', :backend => 'memcache',
:memcache_servers => 'host1:11211,host2:11211', :memcache_servers => 'host1:11211,host2:11211',
:tls_enabled => true, :enable_socket_keepalive => false,
:manage_backend_package => false, :socket_keepalive_idle => 1,
:socket_keepalive_interval => 1,
:socket_keepalive_count => 1,
:tls_enabled => true,
:manage_backend_package => false,
) )
end end
end end