From a7cf7060ddfeab7440bf2e84522d220014c10bd8 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Thu, 27 Jan 2022 14:04:04 +0900 Subject: [PATCH] Deprecate cache parameters in the base class in favor of the new ceilometer::cache class. This should have been done when we added that class. Change-Id: Ida080fe2a71d6215a8365cfb4f9f902dfcaaa760 --- manifests/cache.pp | 108 ++++++- manifests/init.pp | 279 +++++++++--------- .../notes/cache-opts-cea94fc0d564f820.yaml | 24 ++ spec/classes/ceilometer_cache_spec.rb | 30 ++ 4 files changed, 296 insertions(+), 145 deletions(-) create mode 100644 releasenotes/notes/cache-opts-cea94fc0d564f820.yaml diff --git a/manifests/cache.pp b/manifests/cache.pp index 71a47f70..4a59fbc0 100644 --- a/manifests/cache.pp +++ b/manifests/cache.pp @@ -65,6 +65,28 @@ # (floating point value) # Defaults to $::os_service_default # +# [*enable_socket_keepalive*] +# (Optional) Global toggle for the socket keepalive of dogpile's +# pymemcache backend +# Defaults to $::os_service_default +# +# [*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 +# +# [*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 +# +# [*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 +# # [*memcache_pool_maxsize*] # (Optional) Max total number of open connections to every memcached server. # (oslo_cache.memcache_pool backend only). (integer value) @@ -118,6 +140,37 @@ # 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 +# +# [*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 +# class ceilometer::cache ( $config_prefix = $::os_service_default, $expiration_time = $::os_service_default, @@ -129,6 +182,10 @@ class ceilometer::cache ( $memcache_servers = $::os_service_default, $memcache_dead_retry = $::os_service_default, $memcache_socket_timeout = $::os_service_default, + $enable_socket_keepalive = $::os_service_default, + $socket_keepalive_idle = $::os_service_default, + $socket_keepalive_interval = $::os_service_default, + $socket_keepalive_count = $::os_service_default, $memcache_pool_maxsize = $::os_service_default, $memcache_pool_unused_timeout = $::os_service_default, $memcache_pool_connection_get_timeout = $::os_service_default, @@ -138,29 +195,64 @@ class ceilometer::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, + $hashclient_retry_attempts = $::os_service_default, + $hashclient_retry_delay = $::os_service_default, + $dead_timeout = $::os_service_default, ) { include ceilometer::deps + $backend_real = pick($::ceilometer::cache_backend, $backend) + $memcache_servers_real = pick($::ceilometer::memcache_servers, $memcache_servers) + $enable_socket_keepalive_real = pick($::ceilometer::cache_enable_socket_keepalive, $enable_socket_keepalive) + $socket_keepalive_idle_real = pick($::ceilometer::cache_socket_keepalive_idle, $socket_keepalive_idle) + $socket_keepalive_interval_real = pick($::ceilometer::cache_socket_keepalive_interval, $socket_keepalive_interval) + $socket_keepalive_count_real = pick($::ceilometer::cache_socket_keepalive_count, $socket_keepalive_count) + $manage_backend_package_real = pick($::ceilometer::manage_backend_package, $manage_backend_package) + $tls_enabled_real = pick($::ceilometer::cache_tls_enabled, $tls_enabled) + $tls_cafile_real = pick($::ceilometer::cache_tls_cafile, $tls_cafile) + $tls_certfile_real = pick($::ceilometer::cache_tls_certfile, $tls_certfile) + $tls_keyfile_real = pick($::ceilometer::cache_tls_keyfile, $tls_keyfile) + $tls_allowed_ciphers_real = pick($::ceilometer::cache_tls_allowed_ciphers, $tls_allowed_ciphers) + $enable_retry_client_real = pick($::ceilometer::cache_enable_retry_client, $enable_retry_client) + $retry_attempts_real = pick($::ceilometer::cache_retry_attempts, $retry_attempts) + $retry_delay_real = pick($::ceilometer::cache_retry_delay, $retry_delay) + $hashclient_retry_attempts_real = pick($::ceilometer::cache_hashclient_retry_attempts, $hashclient_retry_attempts) + $hashclient_retry_delay_real = pick($::ceilometer::cache_hashclient_retry_delay, $hashclient_retry_delay) + $dead_timeout_real = pick($::ceilometer::cache_dead_timeout, $dead_timeout) + oslo::cache { 'ceilometer_config': config_prefix => $config_prefix, expiration_time => $expiration_time, - backend => $backend, + backend => $backend_real, backend_argument => $backend_argument, proxies => $proxies, enabled => $enabled, debug_cache_backend => $debug_cache_backend, - memcache_servers => $memcache_servers, + memcache_servers => $memcache_servers_real, memcache_dead_retry => $memcache_dead_retry, memcache_socket_timeout => $memcache_socket_timeout, + enable_socket_keepalive => $enable_socket_keepalive_real, + socket_keepalive_idle => $socket_keepalive_idle_real, + socket_keepalive_interval => $socket_keepalive_interval_real, + socket_keepalive_count => $socket_keepalive_count_real, memcache_pool_maxsize => $memcache_pool_maxsize, memcache_pool_unused_timeout => $memcache_pool_unused_timeout, memcache_pool_connection_get_timeout => $memcache_pool_connection_get_timeout, - manage_backend_package => $manage_backend_package, - tls_enabled => $tls_enabled, - tls_cafile => $tls_cafile, - tls_certfile => $tls_certfile, - tls_keyfile => $tls_keyfile, - tls_allowed_ciphers => $tls_allowed_ciphers, + manage_backend_package => $manage_backend_package_real, + tls_enabled => $tls_enabled_real, + tls_cafile => $tls_cafile_real, + tls_certfile => $tls_certfile_real, + tls_keyfile => $tls_keyfile_real, + tls_allowed_ciphers => $tls_allowed_ciphers_real, + enable_retry_client => $enable_retry_client_real, + retry_attempts => $retry_attempts_real, + retry_delay => $retry_delay_real, + hashclient_retry_attempts => $hashclient_retry_attempts_real, + hashclient_retry_delay => $hashclient_retry_delay_real, + dead_timeout => $dead_timeout_real, } } diff --git a/manifests/init.pp b/manifests/init.pp index b7203f2b..b64115be 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -130,104 +130,6 @@ # (string value) # Defaults to $::os_service_default # -# [*cache_backend*] -# (Optional) The backend to pass to oslo::cache. -# Defaults to $::os_service_default -# -# [*memcache_servers*] -# (Optional) A list of memcached server(s) to use for caching. (list value) -# 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*] -# (Optional) Global toggle for TLS usage when comunicating with -# the caching servers. -# Default to $::os_service_default -# -# [*cache_tls_cafile*] -# (Optional) Path to a file of concatenated CA certificates in PEM -# format necessary to establish the caching server's authenticity. -# If tls_enabled is False, this option is ignored. -# Default to $::os_service_default -# -# [*cache_tls_certfile*] -# (Optional) Path to a single file in PEM format containing the -# client's certificate as well as any number of CA certificates -# needed to establish the certificate's authenticity. This file -# is only required when client side authentication is necessary. -# If tls_enabled is False, this option is ignored. -# Default to $::os_service_default -# -# [*cache_tls_keyfile*] -# (Optional) Path to a single file containing the client's private -# key in. Otherwhise the private key will be taken from the file -# specified in tls_certfile. If tls_enabled is False, this option -# is ignored. -# Default to $::os_service_default -# -# [*cache_tls_allowed_ciphers*] -# (Optional) Set the available ciphers for sockets created with -# the TLS context. It should be a string in the OpenSSL cipher -# list format. If not specified, all OpenSSL enabled ciphers will -# be available. -# Default to $::os_service_default -# -# [*cache_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 -# -# [*cache_retry_attempts*] -# (Optional) Number of times to attempt an action before failing. -# Default to $::os_service_default -# -# [*cache_retry_delay*] -# (Optional) Number of seconds to sleep between each attempt. -# Default to $::os_service_default -# -# [*cache_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 -# -# [*cache_hashclient_retry_delay*] -# (Optional) Time in seconds that should pass between -# retry attempts in the HashClient's internal mechanisms. -# Default to $::os_service_default -# -# [*cache_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) If we should install the cache backend package. -# Defaults to true -# # [*amqp_server_request_prefix*] # (Optional) Address prefix used when sending to a specific server # Defaults to $::os_service_default. @@ -320,6 +222,104 @@ # (Optional) Accept clients using either SSL or plain TCP # Defaults to undef. # +# [*cache_backend*] +# (Optional) The backend to pass to oslo::cache. +# Defaults to undef. +# +# [*memcache_servers*] +# (Optional) A list of memcached server(s) to use for caching. (list value) +# Defaults to undef +# +# [*cache_enable_socket_keepalive*] +# (Optional) Global toggle for the socket keepalive of dogpile's +# pymemcache backend +# Defaults to undef +# +# [*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 undef +# +# [*cache_socket_keepalive_interval*] +# (Optional) The time (in seconds) between individual keepalive probes. +# Should be a positive integer most greater than zero. +# Defaults to undef +# +# [*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 undef +# +# [*cache_tls_enabled*] +# (Optional) Global toggle for TLS usage when comunicating with +# the caching servers. +# Default to undef +# +# [*cache_tls_cafile*] +# (Optional) Path to a file of concatenated CA certificates in PEM +# format necessary to establish the caching server's authenticity. +# If tls_enabled is False, this option is ignored. +# Default to undef +# +# [*cache_tls_certfile*] +# (Optional) Path to a single file in PEM format containing the +# client's certificate as well as any number of CA certificates +# needed to establish the certificate's authenticity. This file +# is only required when client side authentication is necessary. +# If tls_enabled is False, this option is ignored. +# Default to undef +# +# [*cache_tls_keyfile*] +# (Optional) Path to a single file containing the client's private +# key in. Otherwhise the private key will be taken from the file +# specified in tls_certfile. If tls_enabled is False, this option +# is ignored. +# Default to undef +# +# [*cache_tls_allowed_ciphers*] +# (Optional) Set the available ciphers for sockets created with +# the TLS context. It should be a string in the OpenSSL cipher +# list format. If not specified, all OpenSSL enabled ciphers will +# be available. +# Default to undef +# +# [*cache_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 undef +# +# [*cache_retry_attempts*] +# (Optional) Number of times to attempt an action before failing. +# Default to undef +# +# [*cache_retry_delay*] +# (Optional) Number of seconds to sleep between each attempt. +# Default to undef +# +# [*cache_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 undef +# +# [*cache_hashclient_retry_delay*] +# (Optional) Time in seconds that should pass between +# retry attempts in the HashClient's internal mechanisms. +# Default to undef +# +# [*cache_dead_timeout*] +# (Optional) Time in seconds before attempting to add a node +# back in the pool in the HashClient's internal mechanisms. +# Default to undef +# +# [*manage_backend_package*] +# (Optional) If we should install the cache backend package. +# Defaults to undef +# class ceilometer( $http_timeout = $::os_service_default, $max_parallel_requests = $::os_service_default, @@ -346,24 +346,6 @@ class ceilometer( $kombu_reconnect_delay = $::os_service_default, $kombu_failover_strategy = $::os_service_default, $kombu_compression = $::os_service_default, - $cache_backend = $::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_cafile = $::os_service_default, - $cache_tls_certfile = $::os_service_default, - $cache_tls_keyfile = $::os_service_default, - $cache_tls_allowed_ciphers = $::os_service_default, - $cache_enable_retry_client = $::os_service_default, - $cache_retry_attempts = $::os_service_default, - $cache_retry_delay = $::os_service_default, - $cache_hashclient_retry_attempts = $::os_service_default, - $cache_hashclient_retry_delay = $::os_service_default, - $cache_dead_timeout = $::os_service_default, - $manage_backend_package = true, $amqp_server_request_prefix = $::os_service_default, $amqp_broadcast_prefix = $::os_service_default, $amqp_group_request_prefix = $::os_service_default, @@ -387,6 +369,24 @@ class ceilometer( $host = $::os_service_default, # DEPRECATED PARAMETERS $amqp_allow_insecure_clients = undef, + $cache_backend = undef, + $memcache_servers = undef, + $cache_enable_socket_keepalive = undef, + $cache_socket_keepalive_idle = undef, + $cache_socket_keepalive_interval = undef, + $cache_socket_keepalive_count = undef, + $cache_tls_enabled = undef, + $cache_tls_cafile = undef, + $cache_tls_certfile = undef, + $cache_tls_keyfile = undef, + $cache_tls_allowed_ciphers = undef, + $cache_enable_retry_client = undef, + $cache_retry_attempts = undef, + $cache_retry_delay = undef, + $cache_hashclient_retry_attempts = undef, + $cache_hashclient_retry_delay = undef, + $cache_dead_timeout = undef, + $manage_backend_package = undef, ) { include ceilometer::deps @@ -397,6 +397,32 @@ class ceilometer( will be removed in a future release.') } + [ + 'cache_backend', + 'memcache_servers', + 'cache_enable_socket_keepalive', + 'cache_socket_keepalive_idle', + 'cache_socket_keepalive_interval', + 'cache_socket_keepalive_count', + 'cache_tls_enabled', + 'cache_tls_cafile', + 'cache_tls_certfile', + 'cache_tls_keyfile', + 'cache_tls_allowed_ciphers', + 'cache_enable_retry_client', + 'cache_retry_attempts', + 'cache_retry_delay', + 'cache_hashclient_retry_attempts', + 'cache_hashclient_retry_delay', + 'cache_dead_timeout', + 'manage_backend_package' + ].each |String $cache_opt| { + if getvar($cache_opt) != undef { + warning("The ceilometer::${cache_opt} parameter is deprecated. Use the ceilometer::cache class") + } + } + include ceilometer::cache + group { 'ceilometer': ensure => present, name => 'ceilometer', @@ -480,25 +506,4 @@ will be removed in a future release.') rpc_response_timeout => $rpc_response_timeout, control_exchange => $control_exchange, } - - oslo::cache { 'ceilometer_config': - backend => $cache_backend, - memcache_servers => $memcache_servers, - enable_socket_keepalive => $cache_enable_socket_keepalive, - socket_keepalive_idle => $cache_socket_keepalive_idle, - socket_keepalive_interval => $cache_socket_keepalive_interval, - socket_keepalive_count => $cache_socket_keepalive_count, - tls_enabled => $cache_tls_enabled, - tls_cafile => $cache_tls_cafile, - tls_certfile => $cache_tls_certfile, - tls_keyfile => $cache_tls_keyfile, - tls_allowed_ciphers => $cache_tls_allowed_ciphers, - enable_retry_client => $cache_enable_retry_client, - retry_attempts => $cache_retry_attempts, - retry_delay => $cache_retry_delay, - hashclient_retry_attempts => $cache_hashclient_retry_attempts, - hashclient_retry_delay => $cache_hashclient_retry_delay, - dead_timeout => $cache_dead_timeout, - manage_backend_package => $manage_backend_package, - } } diff --git a/releasenotes/notes/cache-opts-cea94fc0d564f820.yaml b/releasenotes/notes/cache-opts-cea94fc0d564f820.yaml new file mode 100644 index 00000000..fcfcdedb --- /dev/null +++ b/releasenotes/notes/cache-opts-cea94fc0d564f820.yaml @@ -0,0 +1,24 @@ +--- +deprecations: + - | + The following parameters of the ``ceilometer`` class have been deprecated. + Use the new ``ceilometer::cache`` class. + + - ``cache_backend`` + - ``memcache_servers`` + - ``cache_enable_socket_keepalive`` + - ``cache_socket_keepalive_idle`` + - ``cache_socket_keepalive_interval`` + - ``cache_socket_keepalive_count`` + - ``cache_tls_enabled`` + - ``cache_tls_cafile`` + - ``cache_tls_certfile`` + - ``cache_tls_keyfile`` + - ``cache_tls_allowed_ciphers`` + - ``cache_enable_retry_client`` + - ``cache_retry_attempts`` + - ``cache_retry_delay`` + - ``cache_hashclient_retry_attempts`` + - ``cache_hashclient_retry_delay`` + - ``cache_dead_timeout`` + - ``manage_backend_package`` diff --git a/spec/classes/ceilometer_cache_spec.rb b/spec/classes/ceilometer_cache_spec.rb index 8e5cb890..b1d23581 100644 --- a/spec/classes/ceilometer_cache_spec.rb +++ b/spec/classes/ceilometer_cache_spec.rb @@ -21,6 +21,10 @@ describe 'ceilometer::cache' do :memcache_servers => '', :memcache_dead_retry => '', :memcache_socket_timeout => '', + :enable_socket_keepalive => '', + :socket_keepalive_idle => '', + :socket_keepalive_interval => '', + :socket_keepalive_count => '', :memcache_pool_maxsize => '', :memcache_pool_unused_timeout => '', :memcache_pool_connection_get_timeout => '', @@ -29,6 +33,12 @@ describe 'ceilometer::cache' do :tls_certfile => '', :tls_keyfile => '', :tls_allowed_ciphers => '', + :enable_retry_client => '', + :retry_attempts => '', + :retry_delay => '', + :hashclient_retry_attempts => '', + :hashclient_retry_delay => '', + :dead_timeout => '', :manage_backend_package => true, ) end @@ -46,10 +56,20 @@ describe 'ceilometer::cache' do :memcache_servers => ['memcached01:11211', 'memcached02:11211'], :memcache_dead_retry => '60', :memcache_socket_timeout => '300.0', + :enable_socket_keepalive => false, + :socket_keepalive_idle => 1, + :socket_keepalive_interval => 1, + :socket_keepalive_count => 1, :memcache_pool_maxsize => '10', :memcache_pool_unused_timeout => '120', :memcache_pool_connection_get_timeout => '360', :tls_enabled => false, + :enable_retry_client => false, + :retry_attempts => 2, + :retry_delay => 0, + :hashclient_retry_attempts => 2, + :hashclient_retry_delay => 1, + :dead_timeout => 60, :manage_backend_package => false, } end @@ -66,6 +86,10 @@ describe 'ceilometer::cache' do :memcache_servers => ['memcached01:11211', 'memcached02:11211'], :memcache_dead_retry => '60', :memcache_socket_timeout => '300.0', + :enable_socket_keepalive => false, + :socket_keepalive_idle => 1, + :socket_keepalive_interval => 1, + :socket_keepalive_count => 1, :memcache_pool_maxsize => '10', :memcache_pool_unused_timeout => '120', :memcache_pool_connection_get_timeout => '360', @@ -74,6 +98,12 @@ describe 'ceilometer::cache' do :tls_certfile => '', :tls_keyfile => '', :tls_allowed_ciphers => '', + :enable_retry_client => false, + :retry_attempts => 2, + :retry_delay => 0, + :hashclient_retry_attempts => 2, + :hashclient_retry_delay => 1, + :dead_timeout => 60, :manage_backend_package => false, ) end