Browse Source

Remove deprecated params and agents

Removes the parameters and agents that has been
deprecated for atleast one cycle.

Change-Id: I33c45e1ac69348df3d4f0a0df4561295123bdcce
changes/28/677428/1
Tobias Urdin 3 years ago
parent
commit
ddf478bc55
  1. 9
      examples/site.pp
  2. 63
      manifests/agent/central.pp
  3. 82
      manifests/agent/compute.pp
  4. 24
      manifests/init.pp
  5. 8
      manifests/params.pp
  6. 7
      releasenotes/notes/remove-deprecated-3ba888b555b46f29.yaml
  7. 97
      spec/classes/ceilometer_agent_central_spec.rb
  8. 132
      spec/classes/ceilometer_agent_compute_spec.rb

9
examples/site.pp

@ -64,15 +64,6 @@ node default {
ipmi_namespace => false,
}
# Install compute agent (deprecated)
# default: enable
# class { 'ceilometer::agent::compute':
# }
# Install central agent (deprecated)
# class { 'ceilometer::agent::central':
# }
# Purge old meters
class { '::ceilometer::expirer': }

63
manifests/agent/central.pp

@ -1,63 +0,0 @@
# == Class: ceilometer::agent::central
#
# Installs/configures the ceilometer central agent
#
# === Parameters:
#
# [*enabled*]
# (Optional) Should the service be enabled.
# Defaults to true.
#
# [*manage_service*]
# (Optional) Whether the service should be managed by Puppet.
# Defaults to true.
#
# [*package_ensure*]
# (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::deps
include ::ceilometer::params
warning('This class is deprecated. Please use ceilometer::agent::polling with central namespace instead.')
package { 'ceilometer-agent-central':
ensure => $package_ensure,
name => $::ceilometer::params::agent_central_package_name,
tag => ['openstack', 'ceilometer-package'],
}
if $manage_service {
if $enabled {
$service_ensure = 'running'
} else {
$service_ensure = 'stopped'
}
}
service { 'ceilometer-agent-central':
ensure => $service_ensure,
name => $::ceilometer::params::agent_central_service_name,
enable => $enabled,
hasstatus => true,
hasrestart => true,
tag => 'ceilometer-service',
}
if $coordination_url {
ensure_resource('ceilometer_config', 'coordination/backend_url',
{'value' => $coordination_url})
}
}

82
manifests/agent/compute.pp

@ -1,82 +0,0 @@
# == Class: ceilometer::agent::compute
#
# The ceilometer::agent::compute class installs the ceilometer compute agent
# Include this class on all nova compute nodes
#
# === Parameters:
#
# [*enabled*]
# (Optional) Should the service be enabled.
# Defaults to true.
#
# [*manage_service*]
# (Optional) Whether the service should be managed by Puppet.
# Defaults to true.
#
# [*package_ensure*]
# (Optional) ensure state for package.
# Defaults to 'present'.
#
# [*instance_discovery_method*]
# (Optional) method to discovery instances running on compute node
# Defaults to $::os_service_default
# * naive: poll nova to get all instances
# * workload_partitioning: poll nova to get instances of the compute
# * libvirt_metadata: get instances from libvirt metadata
# but without instance metadata (recommended for Gnocchi backend).
#
class ceilometer::agent::compute (
$manage_service = true,
$enabled = true,
$package_ensure = 'present',
$instance_discovery_method = $::os_service_default,
) inherits ceilometer {
warning('This class is deprecated. Please use ceilometer::agent::polling with compute namespace instead.')
include ::ceilometer::params
ceilometer_config {
'compute/instance_discovery_method': value => $instance_discovery_method,
}
Ceilometer_config<||> ~> Service['ceilometer-agent-compute']
Package['ceilometer-agent-compute'] -> Service['ceilometer-agent-compute']
package { 'ceilometer-agent-compute':
ensure => $package_ensure,
name => $::ceilometer::params::agent_compute_package_name,
tag => ['openstack', 'ceilometer-package'],
}
if $::ceilometer::params::libvirt_group {
User['ceilometer'] {
groups => ['nova', $::ceilometer::params::libvirt_group]
}
Package <| title == 'libvirt' |> -> User['ceilometer']
} else {
User['ceilometer'] {
groups => ['nova']
}
}
Package <| title == 'ceilometer-common' |> -> User['ceilometer']
if $manage_service {
if $enabled {
$service_ensure = 'running'
} else {
$service_ensure = 'stopped'
}
}
Package <| title == 'nova-common' |> -> Package['ceilometer-common'] -> Service['ceilometer-agent-compute']
service { 'ceilometer-agent-compute':
ensure => $service_ensure,
name => $::ceilometer::params::agent_compute_service_name,
enable => $enabled,
hasstatus => true,
hasrestart => true,
tag => 'ceilometer-service',
}
}

24
manifests/init.pp

@ -205,18 +205,6 @@
# IP address.
# Defaults to $::os_service_default.
#
# ### DEPRECATED PARAMETERS
#
# [*event_time_to_live*]
# (Optional) Number of seconds that events are kept in the database for
# (<= 0 means forever)
# Defaults to undef.
#
# [*metering_time_to_live*]
# (Optional) Number of seconds that samples are kept in the database for
# (<= 0 means forever)
# Defaults to undef.
#
class ceilometer(
$http_timeout = '600',
$telemetry_secret = false,
@ -263,20 +251,8 @@ class ceilometer(
$snmpd_readonly_user_password = $::os_service_default,
$purge_config = false,
$host = $::os_service_default,
## DEPRECATED PARAMETERS
$event_time_to_live = undef,
$metering_time_to_live = undef,
) {
if $metering_time_to_live {
warning('The metering_time_to_live parameter is deprecated, ignored and will be
removed in the futrure.')
}
if $event_time_to_live {
warning('The event_time_to_live parameter is deprecated, ignored and will be
removed in the futrure.')
}
include ::ceilometer::deps
include ::ceilometer::params

8
manifests/params.pp

@ -44,28 +44,20 @@ class ceilometer::params {
case $::osfamily {
'RedHat': {
# package names
$agent_central_package_name = 'openstack-ceilometer-central'
$agent_compute_package_name = 'openstack-ceilometer-compute'
$agent_polling_package_name = 'openstack-ceilometer-polling'
$agent_notification_package_name = 'openstack-ceilometer-notification'
$common_package_name = 'openstack-ceilometer-common'
# service names
$agent_central_service_name = 'openstack-ceilometer-central'
$agent_compute_service_name = 'openstack-ceilometer-compute'
$agent_polling_service_name = 'openstack-ceilometer-polling'
$agent_notification_service_name = 'openstack-ceilometer-notification'
$libvirt_group = undef
}
'Debian': {
# package names
$agent_central_package_name = 'ceilometer-agent-central'
$agent_compute_package_name = 'ceilometer-agent-compute'
$agent_polling_package_name = 'ceilometer-polling'
$agent_notification_package_name = 'ceilometer-agent-notification'
$common_package_name = 'ceilometer-common'
# service names
$agent_central_service_name = 'ceilometer-agent-central'
$agent_compute_service_name = 'ceilometer-agent-compute'
$agent_polling_service_name = 'ceilometer-polling'
$agent_notification_service_name = 'ceilometer-agent-notification'
$libvirt_group = 'libvirt'

7
releasenotes/notes/remove-deprecated-3ba888b555b46f29.yaml

@ -0,0 +1,7 @@
---
upgrade:
- |
The deprecated parameters ceilometer::event_time_to_live and ceilometer::metering_time_to_live is removed.
- |
The deprecated classes ceilometer::agent::central and ceilometer::agent::compute
is removed. Please use the ceilometer::agent::polling class with the correct namespaces instead.

97
spec/classes/ceilometer_agent_central_spec.rb

@ -1,97 +0,0 @@
require 'spec_helper'
describe 'ceilometer::agent::central' do
let :pre_condition do
"class { 'ceilometer': telemetry_secret => 's3cr3t' }"
end
let :params do
{ :enabled => true,
:manage_service => true,
:package_ensure => 'latest',
:coordination_url => 'redis://localhost:6379'
}
end
shared_examples_for 'ceilometer-agent-central' do
it { is_expected.to contain_class('ceilometer::deps') }
it { is_expected.to contain_class('ceilometer::params') }
it 'installs ceilometer-agent-central package' do
is_expected.to contain_package('ceilometer-agent-central').with(
:ensure => 'latest',
:name => platform_params[:agent_package_name],
:tag => ['openstack', 'ceilometer-package'],
)
end
[{:enabled => true}, {:enabled => false}].each do |param_hash|
context "when service should be #{param_hash[:enabled] ? 'enabled' : 'disabled'}" do
before do
params.merge!(param_hash)
end
it 'configures ceilometer-agent-central service' do
is_expected.to contain_service('ceilometer-agent-central').with(
:ensure => (params[:manage_service] && params[:enabled]) ? 'running' : 'stopped',
:name => platform_params[:agent_service_name],
:enable => params[:enabled],
:hasstatus => true,
:hasrestart => true,
:tag => 'ceilometer-service',
)
end
end
end
it 'configures central agent' do
is_expected.to contain_ceilometer_config('coordination/backend_url').with_value( params[:coordination_url] )
end
context 'with disabled service managing' do
before do
params.merge!({
:manage_service => false,
:enabled => false })
end
it 'configures ceilometer-agent-central service' do
is_expected.to contain_service('ceilometer-agent-central').with(
:ensure => nil,
:name => platform_params[:agent_service_name],
:enable => false,
:hasstatus => true,
:hasrestart => true,
:tag => 'ceilometer-service',
)
end
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
let :platform_params do
case facts[:osfamily]
when 'Debian'
{ :agent_package_name => 'ceilometer-agent-central',
:agent_service_name => 'ceilometer-agent-central' }
when 'RedHat'
{ :agent_package_name => 'openstack-ceilometer-central',
:agent_service_name => 'openstack-ceilometer-central' }
end
end
it_behaves_like 'ceilometer-agent-central'
end
end
end

132
spec/classes/ceilometer_agent_compute_spec.rb

@ -1,132 +0,0 @@
require 'spec_helper'
describe 'ceilometer::agent::compute' do
let :pre_condition do
"include nova\n" +
"include nova::compute\n" +
"class { 'ceilometer': telemetry_secret => 's3cr3t' }"
end
let :params do
{ :enabled => true,
:manage_service => true,
:package_ensure => 'installed' }
end
shared_examples_for 'ceilometer-agent-compute' do
it { is_expected.to contain_class('ceilometer::deps') }
it { is_expected.to contain_class('ceilometer::params') }
it 'installs ceilometer-agent-compute package' do
is_expected.to contain_package('ceilometer-agent-compute').with(
:ensure => 'installed',
:name => platform_params[:agent_package_name],
:before => ['Service[ceilometer-agent-compute]'],
:tag => ['openstack', 'ceilometer-package'],
)
end
it 'configures agent compute default instance discovery' do
is_expected.to contain_ceilometer_config('compute/instance_discovery_method').with_value('<SERVICE DEFAULT>')
end
it 'adds ceilometer user to nova group and, if required, to libvirt group' do
if platform_params[:libvirt_group]
is_expected.to contain_user('ceilometer').with_groups(['nova', "#{platform_params[:libvirt_group]}"])
else
is_expected.to contain_user('ceilometer').with_groups(['nova'])
end
end
it 'ensures ceilometer-common is installed before the service' do
is_expected.to contain_package('ceilometer-common').with(
:before => /Service\[ceilometer-agent-compute\]/
)
end
it 'ensures nova-common is installed before the package ceilometer-common' do
is_expected.to contain_package('nova-common').with(
:before => /Package\[ceilometer-common\]/
)
end
[{:enabled => true}, {:enabled => false}].each do |param_hash|
context "when service should be #{param_hash[:enabled] ? 'enabled' : 'disabled'}" do
before do
params.merge!(param_hash)
end
it 'configures ceilometer-agent-compute service' do
is_expected.to contain_service('ceilometer-agent-compute').with(
:ensure => (params[:manage_service] && params[:enabled]) ? 'running' : 'stopped',
:name => platform_params[:agent_service_name],
:enable => params[:enabled],
:hasstatus => true,
:hasrestart => true,
:tag => 'ceilometer-service',
)
end
end
end
context 'when setting instance_discovery_method' do
before do
params.merge!({ :instance_discovery_method => 'naive' })
end
it 'configures agent compute instance discovery' do
is_expected.to contain_ceilometer_config('compute/instance_discovery_method').with_value('naive')
end
end
context 'with disabled service managing' do
before do
params.merge!({
:manage_service => false,
:enabled => false })
end
it 'configures ceilometer-agent-compute service' do
is_expected.to contain_service('ceilometer-agent-compute').with(
:ensure => nil,
:name => platform_params[:agent_service_name],
:enable => false,
:hasstatus => true,
:hasrestart => true,
:tag => 'ceilometer-service',
)
end
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
let :platform_params do
case facts[:osfamily]
when 'Debian'
{ :agent_package_name => 'ceilometer-agent-compute',
:agent_service_name => 'ceilometer-agent-compute',
:libvirt_group => 'libvirt' }
when 'RedHat'
{ :agent_package_name => 'openstack-ceilometer-compute',
:agent_service_name => 'openstack-ceilometer-compute' }
end
end
it_behaves_like 'ceilometer-agent-compute'
end
end
end
Loading…
Cancel
Save