Remove implementations to set up Ceilometer DB

Ceilometer no longer requires its own database since metric/event
storage was offloaded to Gnocchi/Panko. These implementations were
formally deprecated during the previous cycle[1] so can be removed.

This also updates the outdated example manifests to adapt to
the removal and the recent refactoring.

[1] 60882c29df

Change-Id: Id18b9221703eda9311b81c5a5dfdd41cc68f5424
This commit is contained in:
Takashi Kajinami 2022-11-24 13:50:42 +09:00
parent 6d78011587
commit 834d9a6780
11 changed files with 17 additions and 428 deletions

View File

@ -61,7 +61,7 @@ class { 'ceilometer::keystone::auth':
class { 'ceilometer::collector': }
class { 'ceilometer::agent::polling': }
class { 'ceilometer::agent::notification': }
class { 'ceilometer::db': }
class { 'ceilometer::db::sync': }
class { 'ceilometer::keystone::authtoken':
password => 'a_big_secret',
auth_url => 'http://127.0.0.1:5000/',

View File

@ -2,12 +2,7 @@ class { 'ceilometer':
telemetry_secret => 'secrete',
default_transport_url => 'rabbit://ceilometer:an_even_bigger_secret@127.0.0.1:5672',
}
class { 'ceilometer::db::mysql':
password => 'a_big_secret',
}
class { 'ceilometer::db':
database_connection => 'mysql://ceilometer:a_big_secret@127.0.0.1/ceilometer?charset=utf8',
}
class { 'ceilometer::db::sync': }
class { 'ceilometer::keystone::auth':
password => 'a_big_secret',
}

View File

@ -3,13 +3,6 @@ node default {
path => ['/usr/bin', '/bin', '/usr/sbin', '/sbin']
}
# First, install a mysql server
class { 'mysql::server': }
# And create the database
class { 'ceilometer::db::mysql':
password => 'ceilometer',
}
# Add the base ceilometer class & parameters
# This class is required by ceilometer agents & api classes
# The telemetry_secret parameter is mandatory
@ -17,22 +10,16 @@ node default {
telemetry_secret => 'darksecret'
}
# Configure the ceilometer database
# Only needed if ceilometer::agent::polling or ceilometer::api are declared
class { 'ceilometer::db':
class { 'ceilometer::db::sync': }
class { 'ceilometer::keystone::auth':
password => 'a_big_secret',
}
# Configure ceilometer database with mongodb
# class { 'ceilometer::db':
# database_connection => 'mongodb://localhost:27017/ceilometer',
# require => Class['mongodb'],
# }
# Set common auth parameters used by all agents (compute/central)
class { 'ceilometer::agent::auth':
auth_url => 'http://localhost:5000/v3',
auth_password => 'tralalerotralala'
class { 'ceilometer::agent::service_credentials':
auth_url => 'http://localhost:5000/v3',
password => 'a_big_secret'
}
# Install polling agent

View File

@ -1,86 +0,0 @@
# == Class: ceilometer::db
#
# DEPRECATED !!
# Configures the ceilometer database
# This class will install the required libraries depending on the driver
# specified in the connection_string parameter
#
# === Parameters:
#
# [*database_db_max_retries*]
# (optional) Maximum retries in case of connection error or deadlock error
# before error is raised. Set to -1 to specify an infinite retry count.
# Defaults to $::os_service_default
#
# [*database_connection*]
# (Optional) Url used to connect to database.
# Defaults to 'mysql+pymysql://ceilometer:ceilometer@localhost/ceilometer'.
#
# [*database_connection_recycle_time*]
# (Optional) Timeout when db connections should be reaped.
# Defaults to $::os_service_default.
#
# [*database_max_pool_size*]
# (Optional) Maximum number of SQL connections to keep open in a pool.
# Defaults to $::os_service_default.
#
# [*database_max_retries*]
# (Optional) Maximum db connection retries during startup.
# Setting -1 implies an infinite retry count.
# Defaults to $::os_service_default.
#
# [*database_retry_interval*]
# (Optional) Interval between retries of opening a sql connection.
# Defaults to $::os_service_default.
#
# [*database_max_overflow*]
# (Optional) If set, use this value for max_overflow with sqlalchemy.
# Defaults to $::os_service_default.
#
# [*sync_db*]
# (Optional) enable database schema installation.
# Defaults to true.
#
# [*database_pool_timeout*]
# (Optional) If set, use this value for pool_timeout with SQLAlchemy.
# Defaults to $::os_service_default
#
# [*mysql_enable_ndb*]
# (Optional) If True, transparently enables support for handling MySQL
# Cluster (NDB).
# Defaults to $::os_service_default
#
class ceilometer::db (
$database_db_max_retries = $::os_service_default,
$database_connection = 'mysql+pymysql://ceilometer:ceilometer@localhost/ceilometer',
$database_connection_recycle_time = $::os_service_default,
$database_max_pool_size = $::os_service_default,
$database_max_retries = $::os_service_default,
$database_retry_interval = $::os_service_default,
$database_max_overflow = $::os_service_default,
$database_pool_timeout = $::os_service_default,
$mysql_enable_ndb = $::os_service_default,
$sync_db = true,
) {
include ceilometer::deps
warning('The ceilometer::db class has been deprecated and will be removed in a future release.')
oslo::db { 'ceilometer_config':
db_max_retries => $database_db_max_retries,
connection => $database_connection,
connection_recycle_time => $database_connection_recycle_time,
max_retries => $database_max_retries,
retry_interval => $database_retry_interval,
max_pool_size => $database_max_pool_size,
max_overflow => $database_max_overflow,
pool_timeout => $database_pool_timeout,
mysql_enable_ndb => $mysql_enable_ndb,
}
if $sync_db {
include ceilometer::db::sync
}
}

View File

@ -1,64 +0,0 @@
# == Class: ceilometer::db::mysql
#
# The ceilometer::db::mysql class creates a MySQL database for ceilometer.
# It must be used on the MySQL server
#
# === Parameters:
#
# [*password*]
# (Required) password to connect to the database.
#
# [*dbname*]
# (Optional) name of the database.
# Defaults to ceilometer.
#
# [*user*]
# (Optional) user to connect to the database.
# Defaults to ceilometer.
#
# [*host*]
# (Optional) the default source host user is allowed to connect from.
# Defaults to '127.0.0.1'.
#
# [*allowed_hosts*]
# (Optional) other hosts the user is allowed to connect from.
# Defaults to undef.
#
# [*charset*]
# (Optional) the database charset.
# Defaults to 'utf8'.
#
# [*collate*]
# (Optional) the database collation.
# Defaults to 'utf8_general_ci'.
#
class ceilometer::db::mysql(
$password,
$dbname = 'ceilometer',
$user = 'ceilometer',
$host = '127.0.0.1',
$allowed_hosts = undef,
$charset = 'utf8',
$collate = 'utf8_general_ci',
) {
include ceilometer::deps
validate_legacy(String, 'validate_string', $password)
warning('The ceilometer::db::mysql class has been deprecated and will be removed in a future release.')
openstacklib::db::mysql { 'ceilometer':
user => $user,
password => $password,
dbname => $dbname,
host => $host,
charset => $charset,
collate => $collate,
allowed_hosts => $allowed_hosts,
}
Anchor['ceilometer::db::begin']
~> Class['ceilometer::db::mysql']
~> Anchor['ceilometer::db::end']
}

View File

@ -1,50 +0,0 @@
# == Class: ceilometer::db::postgresql
#
# Class that configures postgresql for ceilometer
# Requires the Puppetlabs postgresql module.
#
# === Parameters:
#
# [*password*]
# (Required) Password to connect to the database.
#
# [*dbname*]
# (Optional) Name of the database.
# Defaults to 'ceilometer'.
#
# [*user*]
# (Optional) User to connect to the database.
# Defaults to 'ceilometer'.
#
# [*encoding*]
# (Optional) The charset to use for the database.
# Default to undef.
#
# [*privileges*]
# (Optional) Privileges given to the database user.
# Default to 'ALL'.
#
class ceilometer::db::postgresql(
$password,
$dbname = 'ceilometer',
$user = 'ceilometer',
$encoding = undef,
$privileges = 'ALL',
) {
include ceilometer::deps
warning('The ceilometer::db::postgresql class has been deprecated and will be removed in a future release.')
openstacklib::db::postgresql { 'ceilometer':
password => $password,
dbname => $dbname,
user => $user,
encoding => $encoding,
privileges => $privileges,
}
Anchor['ceilometer::db::begin']
~> Class['ceilometer::db::postgresql']
~> Anchor['ceilometer::db::end']
}

View File

@ -35,10 +35,6 @@ class ceilometer::deps {
# installed before service startup
Oslo::Coordination<||> -> Anchor['ceilometer::service::begin']
# all db settings should be applied and all packages should be installed
# before dbsync starts
Oslo::Db<||> -> Anchor['ceilometer::dbsync::begin']
# rootwrap config should occur in the config block also.
Anchor['ceilometer::config::begin']
-> Ceilometer_rootwrap_config<||>

View File

@ -0,0 +1,8 @@
---
upgrade:
- |
The following classes have been removed.
- ``ceilometer::db``
- ``ceilometer::db::mysql``
- ``ceilometer::db::postgresql``

View File

@ -1,79 +0,0 @@
require 'spec_helper'
describe 'ceilometer::db::mysql' do
let :pre_condition do
'include mysql::server'
end
let :params do
{ :password => 'ceilometerpass',
:dbname => 'ceilometer',
:user => 'ceilometer',
:host => 'localhost',
:charset => 'utf8',
:collate => 'utf8_general_ci',
}
end
shared_examples_for 'ceilometer mysql database' do
it { is_expected.to contain_class('ceilometer::deps') }
context 'when omitting the required parameter password' do
before { params.delete(:password) }
it { expect { is_expected.to raise_error(Puppet::Error) } }
end
it 'creates a mysql database' do
is_expected.to contain_openstacklib__db__mysql( params[:dbname] ).with(
:user => params[:user],
:password => params[:password],
:host => params[:host],
:charset => params[:charset]
)
end
describe "overriding allowed_hosts param to array" do
let :params do
{
:password => 'ceilometerpass',
:allowed_hosts => ['localhost','%']
}
end
end
describe "overriding allowed_hosts param to string" do
let :params do
{
:password => 'ceilometerpass2',
:allowed_hosts => '192.168.1.1'
}
end
end
describe "overriding allowed_hosts param equals to host param " do
let :params do
{
:password => 'ceilometerpass2',
:allowed_hosts => 'localhost'
}
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
it_behaves_like 'ceilometer mysql database'
end
end
end

View File

@ -1,48 +0,0 @@
require 'spec_helper'
describe 'ceilometer::db::postgresql' do
shared_examples_for 'ceilometer::db::postgresql' do
let :req_params do
{ :password => 'ceilometerpass' }
end
let :pre_condition do
'include postgresql::server'
end
context 'with only required parameters' do
let :params do
req_params
end
it { is_expected.to contain_class('ceilometer::deps') }
it { is_expected.to contain_openstacklib__db__postgresql('ceilometer').with(
:user => 'ceilometer',
:password => 'ceilometerpass',
:dbname => 'ceilometer',
:encoding => nil,
:privileges => 'ALL',
)}
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({
# puppet-postgresql requires the service_provider fact provided by
# puppetlabs-postgresql.
:service_provider => 'systemd'
}))
end
it_configures 'ceilometer::db::postgresql'
end
end
end

View File

@ -1,70 +0,0 @@
require 'spec_helper'
describe 'ceilometer::db' do
shared_examples 'ceilometer::db' do
context 'with default parameters' do
it { should contain_class('ceilometer::deps') }
it { should contain_oslo__db('ceilometer_config').with(
:db_max_retries => '<SERVICE DEFAULT>',
:connection => 'mysql+pymysql://ceilometer:ceilometer@localhost/ceilometer',
:connection_recycle_time => '<SERVICE DEFAULT>',
:max_pool_size => '<SERVICE DEFAULT>',
:max_retries => '<SERVICE DEFAULT>',
:retry_interval => '<SERVICE DEFAULT>',
:max_overflow => '<SERVICE DEFAULT>',
:pool_timeout => '<SERVICE DEFAULT>',
:mysql_enable_ndb => '<SERVICE DEFAULT>',
)}
it { should contain_class('ceilometer::db::sync') }
end
context 'with specific parameters' do
let :params do
{
:database_db_max_retries => '-1',
:database_connection => 'mysql+pymysql://ceilometer:ceilometer@localhost2/ceilometer',
:database_connection_recycle_time => '3601',
:database_max_pool_size => '11',
:database_max_retries => '11',
:database_retry_interval => '11',
:database_max_overflow => '21',
:database_pool_timeout => '21',
:mysql_enable_ndb => true,
:sync_db => false }
end
it { should contain_class('ceilometer::deps') }
it { should contain_oslo__db('ceilometer_config').with(
:db_max_retries => '-1',
:connection => 'mysql+pymysql://ceilometer:ceilometer@localhost2/ceilometer',
:connection_recycle_time => '3601',
:max_pool_size => '11',
:max_retries => '11',
:retry_interval => '11',
:max_overflow => '21',
:pool_timeout => '21',
:mysql_enable_ndb => true,
)}
it { should_not contain_class('ceilometer::db::sync') }
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({
:concat_basedir => '/var/lib/puppet/concat',
:fqdn => 'some.host.tld',
}))
end
it_behaves_like 'ceilometer::db'
end
end
end