From f7dbe8aa5f4ebc31d77344932fef2eea84a32906 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Beraud?= Date: Fri, 28 Jan 2022 11:24:04 +0100 Subject: [PATCH] Add retrying options to oslo.cache This patch specifies a set of options required to setup the retrying wrapper feature of pymemcache (dogpile.cache) cache backend. Original oslo.cache change: https://review.opendev.org/c/openstack/oslo.cache/+/803747 Change-Id: If4622f85e1e7f715805b205bfc3c16cb1e53b943 --- manifests/cache.pp | 21 +++++++++++++++++++ .../pymemcache_retrying-4fa326e3bc913a97.yaml | 4 ++++ spec/defines/oslo_cache_spec.rb | 9 ++++++++ 3 files changed, 34 insertions(+) create mode 100644 releasenotes/notes/pymemcache_retrying-4fa326e3bc913a97.yaml diff --git a/manifests/cache.pp b/manifests/cache.pp index 3ff5e02..63c3017 100644 --- a/manifests/cache.pp +++ b/manifests/cache.pp @@ -168,6 +168,21 @@ # be available. # Default to $::os_service_default # +# [*enable_retry_client*] +# (Optional) Enable retry client mechanisms to handle failure. +# Those mechanisms can be used to wrap all kind of pymemcache +# clients. The wrapper allows you to define how many attempts +# to make and how long to wait between attemots. +# Default to $::os_service_default +# +# [*retry_attempts*] +# (Optional) Number of times to attempt an action before failing. +# Default to $::os_service_default +# +# [*retry_delay*] +# (Optional) Number of seconds to sleep between each attempt. +# Default to $::os_service_default +# # [*manage_backend_package*] # (Optional) Whether to install the backend package. # Defaults to true. @@ -199,6 +214,9 @@ define oslo::cache( $tls_certfile = $::os_service_default, $tls_keyfile = $::os_service_default, $tls_allowed_ciphers = $::os_service_default, + $enable_retry_client = $::os_service_default, + $retry_attempts = $::os_service_default, + $retry_delay = $::os_service_default, $manage_backend_package = true, $package_ensure = 'present', ){ @@ -260,6 +278,9 @@ define oslo::cache( 'cache/tls_certfile' => { value => $tls_certfile }, 'cache/tls_keyfile' => { value => $tls_keyfile }, 'cache/tls_allowed_ciphers' => { value => $tls_allowed_ciphers }, + 'cache/enable_retry_client' => { value => $enable_retry_client }, + 'cache/retry_attempts' => { value => $retry_attempts }, + 'cache/retry_delay' => { value => $retry_delay }, } create_resources($name, $cache_options) diff --git a/releasenotes/notes/pymemcache_retrying-4fa326e3bc913a97.yaml b/releasenotes/notes/pymemcache_retrying-4fa326e3bc913a97.yaml new file mode 100644 index 0000000..ca381f5 --- /dev/null +++ b/releasenotes/notes/pymemcache_retrying-4fa326e3bc913a97.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + Add retrying options for pymemcache (dogpile.cache) backend. diff --git a/spec/defines/oslo_cache_spec.rb b/spec/defines/oslo_cache_spec.rb index ffb3d1e..282407d 100644 --- a/spec/defines/oslo_cache_spec.rb +++ b/spec/defines/oslo_cache_spec.rb @@ -30,6 +30,9 @@ describe 'oslo::cache' do is_expected.to contain_keystone_config('cache/tls_certfile').with_value('') is_expected.to contain_keystone_config('cache/tls_keyfile').with_value('') is_expected.to contain_keystone_config('cache/tls_allowed_ciphers').with_value('') + 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('') end end @@ -58,6 +61,9 @@ describe 'oslo::cache' do :tls_certfile => nil, :tls_keyfile => nil, :tls_allowed_ciphers => nil, + :enable_retry_client => false, + :retry_attempts => 2, + :retry_delay => 0, } end @@ -84,6 +90,9 @@ describe 'oslo::cache' do is_expected.to contain_keystone_config('cache/tls_certfile').with_value('nil') is_expected.to contain_keystone_config('cache/tls_keyfile').with_value('nil') is_expected.to contain_keystone_config('cache/tls_allowed_ciphers').with_value('nil') + 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') end end