Deprecate parameters under gnocchi::storage
coordination_url[1] and metric_processing_delay[2] under storage section are both deprecated, so deprecate parameters under gnocchi::storage and migrate these parameters to appropriate classes, gnocchi and gnocchi::metricd . [1]70b9ca427b
[2]72fdba704d
Change-Id: I88dff282df4ce477e543dd2fcf5052a9ac472b84
This commit is contained in:
@@ -12,6 +12,10 @@
|
|||||||
# (optional) Connection url for the gnocchi database.
|
# (optional) Connection url for the gnocchi database.
|
||||||
# Defaults to undef.
|
# Defaults to undef.
|
||||||
#
|
#
|
||||||
|
# [*coordination_url*]
|
||||||
|
# (optional) The url to use for distributed group membership coordination.
|
||||||
|
# Defaults to $::os_service_default.
|
||||||
|
#
|
||||||
# [*purge_config*]
|
# [*purge_config*]
|
||||||
# (optional) Whether to set only the specified config options
|
# (optional) Whether to set only the specified config options
|
||||||
# in the gnocchi config.
|
# in the gnocchi config.
|
||||||
@@ -20,6 +24,7 @@
|
|||||||
class gnocchi (
|
class gnocchi (
|
||||||
$package_ensure = 'present',
|
$package_ensure = 'present',
|
||||||
$database_connection = undef,
|
$database_connection = undef,
|
||||||
|
$coordination_url = $::os_service_default,
|
||||||
$purge_config = false,
|
$purge_config = false,
|
||||||
) inherits gnocchi::params {
|
) inherits gnocchi::params {
|
||||||
|
|
||||||
@@ -36,4 +41,21 @@ class gnocchi (
|
|||||||
purge => $purge_config,
|
purge => $purge_config,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$coordination_url_real = pick($::gnocchi::storage::coordination_url, $coordination_url)
|
||||||
|
$storage_package_ensure = pick($::gnocchi::storage::package_ensure, $package_ensure)
|
||||||
|
|
||||||
|
if $coordination_url_real {
|
||||||
|
|
||||||
|
gnocchi_config {
|
||||||
|
'DEFAULT/coordination_url' : value => $coordination_url_real;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($coordination_url_real =~ /^redis/ ) {
|
||||||
|
ensure_resource('package', 'python-redis', {
|
||||||
|
ensure => $storage_package_ensure,
|
||||||
|
name => $::gnocchi::params::redis_package_name,
|
||||||
|
tag => 'openstack',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -38,10 +38,12 @@ class gnocchi::metricd (
|
|||||||
|
|
||||||
include gnocchi::deps
|
include gnocchi::deps
|
||||||
|
|
||||||
|
$metric_processing_delay_real = pick($::gnocchi::storage::metric_processing_delay, $metric_processing_delay)
|
||||||
|
|
||||||
gnocchi_config {
|
gnocchi_config {
|
||||||
'metricd/workers': value => $workers;
|
'metricd/workers': value => $workers;
|
||||||
'metricd/metric_cleanup_delay': value => $cleanup_delay;
|
'metricd/metric_cleanup_delay': value => $cleanup_delay;
|
||||||
'metricd/metric_processing_delay': value => $metric_processing_delay;
|
'metricd/metric_processing_delay': value => $metric_processing_delay_real;
|
||||||
}
|
}
|
||||||
|
|
||||||
package { 'gnocchi-metricd':
|
package { 'gnocchi-metricd':
|
||||||
|
@@ -16,39 +16,41 @@
|
|||||||
#
|
#
|
||||||
# == Parameters
|
# == Parameters
|
||||||
#
|
#
|
||||||
|
# DEPRECATED PARAMETERS
|
||||||
|
#
|
||||||
# [*package_ensure*]
|
# [*package_ensure*]
|
||||||
# (optional) ensure state for package.
|
# (optional) ensure state for package.
|
||||||
# Defaults to 'present'
|
# Defaults to 'present'
|
||||||
#
|
#
|
||||||
# [*coordination_url*]
|
# [*coordination_url*]
|
||||||
# (optional) The url to use for distributed group membership coordination.
|
# (optional) The url to use for distributed group membership coordination.
|
||||||
# Defaults to $::os_service_default.
|
# Defaults to undef
|
||||||
#
|
#
|
||||||
# [*metric_processing_delay*]
|
# [*metric_processing_delay*]
|
||||||
# (optional) Delay between processng metrics
|
# (optional) Delay between processng metrics
|
||||||
# Defaults to $::os_service_default.
|
# Defaults to undef
|
||||||
#
|
#
|
||||||
|
|
||||||
class gnocchi::storage(
|
class gnocchi::storage(
|
||||||
$package_ensure = 'present',
|
# DEPRECATED PARAMETERS
|
||||||
$coordination_url = $::os_service_default,
|
$package_ensure = undef,
|
||||||
$metric_processing_delay = $::os_service_default,
|
$coordination_url = undef,
|
||||||
|
$metric_processing_delay = undef,
|
||||||
) inherits gnocchi::params {
|
) inherits gnocchi::params {
|
||||||
|
|
||||||
include gnocchi::deps
|
include gnocchi::deps
|
||||||
|
|
||||||
|
if $package_ensure {
|
||||||
|
warning('The gnocchi::storage::package_ensure parameter was deprecated. \
|
||||||
|
Use gnocchi::package_ensure instead')
|
||||||
|
}
|
||||||
|
|
||||||
if $coordination_url {
|
if $coordination_url {
|
||||||
|
warning('The gnocchi::storage::coordination_url parameter was deprecated. \
|
||||||
gnocchi_config {
|
Use gnocchi::coordination_url instead')
|
||||||
'storage/coordination_url' : value => $coordination_url;
|
|
||||||
'storage/metric_processing_delay' : value => $metric_processing_delay;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($coordination_url =~ /^redis/ ) {
|
if $metric_processing_delay {
|
||||||
ensure_resource('package', 'python-redis', {
|
warning('The gnocchi::storage::metric_processing_delay parameter was deprecated. \
|
||||||
name => $::gnocchi::params::redis_package_name,
|
Use gnocchi::metricd::metric_processing_delay instead')
|
||||||
tag => 'openstack',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
deprecations:
|
||||||
|
- |
|
||||||
|
gnocchi::storage::coordination_url and gnocchi::storage::package_ensure
|
||||||
|
were deprecated because coordination_url in storage seciton was deprecated
|
||||||
|
in gnocchi. Use the parameters in gnocchi class.
|
||||||
|
- |
|
||||||
|
gnocchi::storage::metric_processing_dealy was deprecated because the
|
||||||
|
corresponding parameter under storage section was deprecated in gnocchi.
|
||||||
|
Use gnocchi::metricd::metric_processing_delay instead.
|
@@ -27,6 +27,32 @@ describe 'gnocchi' do
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'does not configure coordination_url' do
|
||||||
|
is_expected.not_to contain_gnocchi_config('DEFAUTL/coordination_url')
|
||||||
|
is_expected.not_to contain_package('python-redis')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with overriden parameters' do
|
||||||
|
let :params do
|
||||||
|
{ :purge_config => true,
|
||||||
|
:coordination_url => 'redis://localhost:6379', }
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'purges gnocchi config' do
|
||||||
|
is_expected.to contain_resources('gnocchi_config').with({
|
||||||
|
:purge => true
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'cnfigures coordination' do
|
||||||
|
is_expected.to contain_gnocchi_config('DEFAULT/coordination_url').with_value('redis://localhost:6379')
|
||||||
|
is_expected.to contain_package('python-redis').with(
|
||||||
|
:name => platform_params[:redis_package_name],
|
||||||
|
:ensure => 'present',
|
||||||
|
:tag => 'openstack'
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -41,9 +67,13 @@ describe 'gnocchi' do
|
|||||||
let(:platform_params) do
|
let(:platform_params) do
|
||||||
case facts[:osfamily]
|
case facts[:osfamily]
|
||||||
when 'Debian'
|
when 'Debian'
|
||||||
{ :gnocchi_common_package => 'gnocchi-common' }
|
{ :gnocchi_common_package => 'gnocchi-common',
|
||||||
|
:redis_package_name => 'python3-redis'
|
||||||
|
}
|
||||||
when 'RedHat'
|
when 'RedHat'
|
||||||
{ :gnocchi_common_package => 'gnocchi-common' }
|
{ :gnocchi_common_package => 'gnocchi-common',
|
||||||
|
:redis_package_name => 'python-redis'
|
||||||
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
it_behaves_like 'gnocchi'
|
it_behaves_like 'gnocchi'
|
||||||
|
@@ -2,35 +2,8 @@ require 'spec_helper'
|
|||||||
|
|
||||||
describe 'gnocchi::storage' do
|
describe 'gnocchi::storage' do
|
||||||
|
|
||||||
let :params do
|
|
||||||
{ :package_ensure => 'latest' }
|
|
||||||
end
|
|
||||||
|
|
||||||
shared_examples_for 'gnocchi-storage' do
|
shared_examples_for 'gnocchi-storage' do
|
||||||
|
# Nothong to test
|
||||||
it { is_expected.to contain_class('gnocchi::deps') }
|
|
||||||
it { is_expected.to contain_class('gnocchi::params') }
|
|
||||||
|
|
||||||
context 'with coordination' do
|
|
||||||
before do
|
|
||||||
params.merge!({
|
|
||||||
:coordination_url => 'redis://localhost:6379',
|
|
||||||
:metric_processing_delay => 30,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'configures backend_url' do
|
|
||||||
is_expected.to contain_gnocchi_config('storage/coordination_url').with_value('redis://localhost:6379')
|
|
||||||
is_expected.to contain_gnocchi_config('storage/metric_processing_delay').with_value(30)
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'installs python-redis package' do
|
|
||||||
is_expected.to contain_package('python-redis').with(
|
|
||||||
:name => platform_params[:redis_package_name],
|
|
||||||
:tag => 'openstack'
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
on_supported_os({
|
on_supported_os({
|
||||||
|
Reference in New Issue
Block a user