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
This commit is contained in:
Hervé Beraud 2022-01-28 11:24:04 +01:00
parent 19ad5b2fa1
commit f7dbe8aa5f
3 changed files with 34 additions and 0 deletions

View File

@ -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)

View File

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

View File

@ -30,6 +30,9 @@ describe 'oslo::cache' do
is_expected.to contain_keystone_config('cache/tls_certfile').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/tls_keyfile').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/tls_allowed_ciphers').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/enable_retry_client').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/retry_attempts').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/retry_delay').with_value('<SERVICE DEFAULT>')
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