From 33d36b597b5b30ee11990d3f255ddc81529da3c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Beraud?= Date: Fri, 28 Jan 2022 11:39:42 +0100 Subject: [PATCH] Add pymemcache's HashClient retrying options to oslo.cache This patch specifies a set of options required to setup pymemcache's HashClient retrying feature (dogpile.cache) cache backend. Original oslo.cache change: https://review.opendev.org/c/openstack/oslo.cache/+/824944 Change-Id: I90d8e2b0cf231c9bd0fe97d4f363795886ccf8c7 (cherry picked from commit 34e1446f44d66a96c8fbe631fc29413de0a51551) (cherry picked from commit edf16447f0a8fa8be0000a3ecf7d751142048a49) (cherry picked from commit d80fbfc9de7e46c8c943454671810a08e43af6e5) (cherry picked from commit 3c5dc525af345b847507ac51dc8d9a3343335786) --- manifests/cache.pp | 22 +++++++++++++++++++ ..._hashclient_retrying-10a756708ad9894b.yaml | 5 +++++ spec/defines/oslo_cache_spec.rb | 9 ++++++++ 3 files changed, 36 insertions(+) create mode 100644 releasenotes/notes/pymemcache_hashclient_retrying-10a756708ad9894b.yaml diff --git a/manifests/cache.pp b/manifests/cache.pp index 9af64a0..bcfda6d 100644 --- a/manifests/cache.pp +++ b/manifests/cache.pp @@ -183,6 +183,22 @@ # (Optional) Number of seconds to sleep between each attempt. # Default to $::os_service_default # +# [*hashclient_retry_attempts*] +# (Optional) Amount of times a client should be tried +# before it is marked dead and removed from the pool in +# the HashClient's internal mechanisms. +# Default to $::os_service_default +# +# [*hashclient_retry_delay*] +# (Optional) Time in seconds that should pass between +# retry attempts in the HashClient's internal mechanisms. +# Default to $::os_service_default +# +# [*dead_timeout*] +# (Optional) Time in seconds before attempting to add a node +# back in the pool in the HashClient's internal mechanisms. +# Default to $::os_service_default +# # [*manage_backend_package*] # (Optional) Whether to install the backend package. # Defaults to true. @@ -213,6 +229,9 @@ define oslo::cache( $enable_retry_client = $::os_service_default, $retry_attempts = $::os_service_default, $retry_delay = $::os_service_default, + $hashclient_retry_attempts = $::os_service_default, + $hashclient_retry_delay = $::os_service_default, + $dead_timeout = $::os_service_default, $manage_backend_package = true, ){ @@ -277,6 +296,9 @@ define oslo::cache( 'cache/enable_retry_client' => { value => $enable_retry_client }, 'cache/retry_attempts' => { value => $retry_attempts }, 'cache/retry_delay' => { value => $retry_delay }, + 'cache/hashclient_retry_attempts' => { value => $hashclient_retry_attempts }, + 'cache/hashclient_retry_delay' => { value => $hashclient_retry_delay }, + 'cache/dead_timeout' => { value => $dead_timeout }, } create_resources($name, $cache_options) diff --git a/releasenotes/notes/pymemcache_hashclient_retrying-10a756708ad9894b.yaml b/releasenotes/notes/pymemcache_hashclient_retrying-10a756708ad9894b.yaml new file mode 100644 index 0000000..116e436 --- /dev/null +++ b/releasenotes/notes/pymemcache_hashclient_retrying-10a756708ad9894b.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Add options to configure pymemcache's HashClient retrying mechanisms + (dogpile.cache) backend. diff --git a/spec/defines/oslo_cache_spec.rb b/spec/defines/oslo_cache_spec.rb index 7846b11..6085b92 100644 --- a/spec/defines/oslo_cache_spec.rb +++ b/spec/defines/oslo_cache_spec.rb @@ -33,6 +33,9 @@ describe 'oslo::cache' do is_expected.to contain_keystone_config('cache/enable_retry_client').with_value('') is_expected.to contain_keystone_config('cache/retry_attempts').with_value('') is_expected.to contain_keystone_config('cache/retry_delay').with_value('') + is_expected.to contain_keystone_config('cache/hashclient_retry_attempts').with_value('') + is_expected.to contain_keystone_config('cache/hashclient_retry_delay').with_value('') + is_expected.to contain_keystone_config('cache/dead_timeout').with_value('') end end @@ -64,6 +67,9 @@ describe 'oslo::cache' do :enable_retry_client => false, :retry_attempts => 2, :retry_delay => 0, + :hashclient_retry_attempts => 2, + :hashclient_retry_delay => 1, + :dead_timeout => 60, } end @@ -93,6 +99,9 @@ describe 'oslo::cache' do is_expected.to contain_keystone_config('cache/enable_retry_client').with_value('false') is_expected.to contain_keystone_config('cache/retry_attempts').with_value('2') is_expected.to contain_keystone_config('cache/retry_delay').with_value('0') + is_expected.to contain_keystone_config('cache/hashclient_retry_attempts').with_value('2') + is_expected.to contain_keystone_config('cache/hashclient_retry_delay').with_value('1') + is_expected.to contain_keystone_config('cache/dead_timeout').with_value('60') end end