Add support for configuring coordination/backend_url
If 'coordination_url' argument and value is provided to the central agent or alarm evaluator classes, they will try to set 'backend_url' in the '[coordination]' section of the ceilometer_config. This allows group membership handling coordinated by tooz. ensure_resource is used to avoid duplicate resources while still allowing the central agent and alarm evaluator to be configured separately if on different machines. Note that this change does not include support for enabling coordination of the compute agent. Change-Id: I707a8b70ad742cc9f8fdc62c196d0e75574a50b2
This commit is contained in:
parent
1d78470e50
commit
fade72deab
@ -13,11 +13,16 @@
|
||||
# (optional) ensure state for package.
|
||||
# Defaults to 'present'
|
||||
#
|
||||
# [*coordination_url*]
|
||||
# (optional) The url to use for distributed group membership coordination.
|
||||
# Defaults to undef.
|
||||
#
|
||||
|
||||
class ceilometer::agent::central (
|
||||
$manage_service = true,
|
||||
$enabled = true,
|
||||
$package_ensure = 'present',
|
||||
$coordination_url = undef,
|
||||
) {
|
||||
|
||||
include ceilometer::params
|
||||
@ -47,4 +52,8 @@ class ceilometer::agent::central (
|
||||
hasrestart => true,
|
||||
}
|
||||
|
||||
if $coordination_url {
|
||||
ensure_resource('ceilometer_config', 'coordination/backend_url',
|
||||
{'value' => $coordination_url})
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,10 @@
|
||||
# (optional) Record alarm change events
|
||||
# Defaults to true.
|
||||
#
|
||||
# [*coordination_url*]
|
||||
# (optional) The url to use for distributed group membership coordination.
|
||||
# Defaults to undef.
|
||||
#
|
||||
class ceilometer::alarm::evaluator (
|
||||
$manage_service = true,
|
||||
$enabled = true,
|
||||
@ -32,6 +36,7 @@ class ceilometer::alarm::evaluator (
|
||||
$evaluation_service = 'ceilometer.alarm.service.SingletonAlarmService',
|
||||
$partition_rpc_topic = 'alarm_partition_coordination',
|
||||
$record_history = true,
|
||||
$coordination_url = undef,
|
||||
) {
|
||||
|
||||
include ceilometer::params
|
||||
@ -67,5 +72,10 @@ class ceilometer::alarm::evaluator (
|
||||
'alarm/evaluation_service' : value => $evaluation_service;
|
||||
'alarm/partition_rpc_topic' : value => $partition_rpc_topic;
|
||||
'alarm/record_history' : value => $record_history;
|
||||
}
|
||||
}
|
||||
|
||||
if $coordination_url {
|
||||
ensure_resource('ceilometer_config', 'coordination/backend_url',
|
||||
{'value' => $coordination_url})
|
||||
}
|
||||
}
|
||||
|
@ -7,9 +7,11 @@ describe 'ceilometer::agent::central' do
|
||||
end
|
||||
|
||||
let :params do
|
||||
{ :enabled => true,
|
||||
:manage_service => true,
|
||||
:package_ensure => 'latest' }
|
||||
{ :enabled => true,
|
||||
:manage_service => true,
|
||||
:package_ensure => 'latest',
|
||||
:coordination_url => 'redis://localhost:6379'
|
||||
}
|
||||
end
|
||||
|
||||
shared_examples_for 'ceilometer-agent-central' do
|
||||
@ -48,6 +50,10 @@ describe 'ceilometer::agent::central' do
|
||||
end
|
||||
end
|
||||
|
||||
it 'configures central agent' do
|
||||
should contain_ceilometer_config('coordination/backend_url').with_value( params[:coordination_url] )
|
||||
end
|
||||
|
||||
context 'with disabled service managing' do
|
||||
before do
|
||||
params.merge!({
|
||||
|
@ -38,6 +38,7 @@ describe 'ceilometer::alarm::evaluator' do
|
||||
should contain_ceilometer_config('alarm/evaluation_service').with_value( params[:evaluation_service] )
|
||||
should contain_ceilometer_config('alarm/partition_rpc_topic').with_value( params[:partition_rpc_topic] )
|
||||
should contain_ceilometer_config('alarm/record_history').with_value( params[:record_history] )
|
||||
should_not contain_ceilometer_config('coordination/backend_url')
|
||||
end
|
||||
|
||||
context 'when overriding parameters' do
|
||||
@ -45,12 +46,14 @@ describe 'ceilometer::alarm::evaluator' do
|
||||
params.merge!(:evaluation_interval => 80,
|
||||
:partition_rpc_topic => 'alarm_partition_coordination',
|
||||
:record_history => false,
|
||||
:evaluation_service => 'ceilometer.alarm.service.SingletonTestAlarmService')
|
||||
:evaluation_service => 'ceilometer.alarm.service.SingletonTestAlarmService',
|
||||
:coordination_url => 'redis://localhost:6379')
|
||||
end
|
||||
it { should contain_ceilometer_config('alarm/evaluation_interval').with_value(params[:evaluation_interval]) }
|
||||
it { should contain_ceilometer_config('alarm/evaluation_service').with_value(params[:evaluation_service]) }
|
||||
it { should contain_ceilometer_config('alarm/record_history').with_value(params[:record_history]) }
|
||||
it { should contain_ceilometer_config('alarm/partition_rpc_topic').with_value(params[:partition_rpc_topic]) }
|
||||
it { should contain_ceilometer_config('coordination/backend_url').with_value( params[:coordination_url]) }
|
||||
end
|
||||
|
||||
context 'when override the evaluation interval with a non numeric value' do
|
||||
|
Loading…
Reference in New Issue
Block a user