Browse Source

Merge "Use oslo::coordination to manage coordination parameters"

changes/83/802283/1 19.1.0
Zuul 3 months ago
committed by Gerrit Code Review
parent
commit
4cd36de603
  1. 29
      manifests/agent/polling.pp
  2. 22
      manifests/coordination.pp
  3. 9
      releasenotes/notes/coordination-6e5105e0558f3e5b.yaml
  4. 1
      spec/classes/ceilometer_agent_polling_spec.rb
  5. 39
      spec/classes/ceilometer_coordination_spec.rb

29
manifests/agent/polling.pp

@ -28,10 +28,6 @@
# (Optional) Use ipmi namespace for polling agent.
# Defaults to true.
#
# [*coordination_url*]
# (Optional) The url to use for distributed group membership coordination.
# Defaults to $::os_service_default.
#
# [*instance_discovery_method*]
# (Optional) method to discovery instances running on compute node
# Defaults to $::os_service_default
@ -58,6 +54,12 @@
# This is used only if manage_polling is true.
# Defaults to undef
#
# DEPRECATED PARAMETERS
#
# [*coordination_url*]
# (Optional) The url to use for distributed group membership coordination.
# Defaults to undef.
#
class ceilometer::agent::polling (
$manage_service = true,
$enabled = true,
@ -65,17 +67,23 @@ class ceilometer::agent::polling (
$central_namespace = true,
$compute_namespace = true,
$ipmi_namespace = true,
$coordination_url = $::os_service_default,
$instance_discovery_method = $::os_service_default,
$manage_polling = false,
$polling_interval = 600,
$polling_meters = $::ceilometer::params::polling_meters,
$polling_config = undef,
# DEPRECATED PARAMETERS
$coordination_url = undef,
) inherits ceilometer {
include ceilometer::deps
include ceilometer::params
if $coordination_url != undef {
warning('The coordination_url parameter has been deprecated. Use ceilometer::coordination instead')
include ceilometer::coordination
}
if $central_namespace {
$central_namespace_name = 'central'
} else {
@ -144,17 +152,6 @@ class ceilometer::agent::polling (
tag => 'ceilometer-service',
}
if $coordination_url == undef {
warning('Usage of undef for the coordination_url parameter has been deprecated. \
Use $::os_service_default instead')
$coordination_url_real = $::os_service_default
} else {
$coordination_url_real = $coordination_url
}
ceilometer_config {
'coordination/backend_url': value => $coordination_url_real
}
if $manage_polling {
if $polling_config {
validate_legacy(Hash, 'validate_hash', $polling_config)

22
manifests/coordination.pp

@ -0,0 +1,22 @@
# == Class: ceilometer::coordination
#
# Setup and configure Ceilometer coordination settings.
#
# === Parameters
#
# [*backend_url*]
# (Optional) Coordination backend URL.
# Defaults to $::os_service_default
#
class ceilometer::coordination (
$backend_url = $::os_service_default,
) {
include ceilometer::deps
$backend_url_real = pick($::ceilometer::agent::polling::coordination_url, $backend_url)
oslo::coordination{ 'ceilometer_config':
backend_url => $backend_url_real
}
}

9
releasenotes/notes/coordination-6e5105e0558f3e5b.yaml

@ -0,0 +1,9 @@
---
features:
- |
The new ``ceilometer::coordination`` class has been added.
deprecations:
- |
The ``ceilometer::agent::polling::coordination_url`` parameter has been
deprecated in favor of the new ``ceilometer::coordination`` class.

1
spec/classes/ceilometer_agent_polling_spec.rb

@ -48,7 +48,6 @@ describe 'ceilometer::agent::polling' do
:tag => 'ceilometer-service',
)}
it { should contain_ceilometer_config('coordination/backend_url').with_value('<SERVICE DEFAULT>') }
it { should_not contain_file('polling') }
end

39
spec/classes/ceilometer_coordination_spec.rb

@ -0,0 +1,39 @@
require 'spec_helper'
describe 'ceilometer::coordination' do
shared_examples 'ceilometer::coordination' do
context 'with default parameters' do
it {
is_expected.to contain_oslo__coordination('ceilometer_config').with(
:backend_url => '<SERVICE DEFAULT>'
)
}
end
context 'with specified parameters' do
let :params do
{
:backend_url => 'etcd3+http://127.0.0.1:2379',
}
end
it {
is_expected.to contain_oslo__coordination('ceilometer_config').with(
:backend_url => 'etcd3+http://127.0.0.1:2379'
)
}
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge(OSDefaults.get_facts())
end
it_behaves_like 'ceilometer::coordination'
end
end
end
Loading…
Cancel
Save