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

View File

@ -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.
@ -217,6 +233,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,
$package_ensure = 'present',
){
@ -281,6 +300,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)

View File

@ -0,0 +1,5 @@
---
features:
- |
Add options to configure pymemcache's HashClient retrying mechanisms
(dogpile.cache) backend.

View File

@ -33,6 +33,9 @@ describe 'oslo::cache' do
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>')
is_expected.to contain_keystone_config('cache/hashclient_retry_attempts').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/hashclient_retry_delay').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('cache/dead_timeout').with_value('<SERVICE DEFAULT>')
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