diff --git a/README.md b/README.md index 026320c9..8dc0db0b 100644 --- a/README.md +++ b/README.md @@ -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/', diff --git a/examples/ceilometer_with_gnocchi.pp b/examples/ceilometer_with_gnocchi.pp index 6ac0bf89..d4efbced 100644 --- a/examples/ceilometer_with_gnocchi.pp +++ b/examples/ceilometer_with_gnocchi.pp @@ -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', } diff --git a/examples/site.pp b/examples/site.pp index 09b0b675..b979aea9 100644 --- a/examples/site.pp +++ b/examples/site.pp @@ -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 diff --git a/manifests/db.pp b/manifests/db.pp deleted file mode 100644 index a259163e..00000000 --- a/manifests/db.pp +++ /dev/null @@ -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 - } - -} diff --git a/manifests/db/mysql.pp b/manifests/db/mysql.pp deleted file mode 100644 index bf1082f3..00000000 --- a/manifests/db/mysql.pp +++ /dev/null @@ -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'] -} diff --git a/manifests/db/postgresql.pp b/manifests/db/postgresql.pp deleted file mode 100644 index d5fe47ac..00000000 --- a/manifests/db/postgresql.pp +++ /dev/null @@ -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'] -} diff --git a/manifests/deps.pp b/manifests/deps.pp index 7cff5ff0..de9e4c22 100644 --- a/manifests/deps.pp +++ b/manifests/deps.pp @@ -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<||> diff --git a/releasenotes/notes/remove-db-opts-89c03fa40ae3cde2.yaml b/releasenotes/notes/remove-db-opts-89c03fa40ae3cde2.yaml new file mode 100644 index 00000000..a6a0361d --- /dev/null +++ b/releasenotes/notes/remove-db-opts-89c03fa40ae3cde2.yaml @@ -0,0 +1,8 @@ +--- +upgrade: + - | + The following classes have been removed. + + - ``ceilometer::db`` + - ``ceilometer::db::mysql`` + - ``ceilometer::db::postgresql`` diff --git a/spec/classes/ceilometer_db_mysql_spec.rb b/spec/classes/ceilometer_db_mysql_spec.rb deleted file mode 100644 index 76ad9830..00000000 --- a/spec/classes/ceilometer_db_mysql_spec.rb +++ /dev/null @@ -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 diff --git a/spec/classes/ceilometer_db_postgresql_spec.rb b/spec/classes/ceilometer_db_postgresql_spec.rb deleted file mode 100644 index 298dd252..00000000 --- a/spec/classes/ceilometer_db_postgresql_spec.rb +++ /dev/null @@ -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 diff --git a/spec/classes/ceilometer_db_spec.rb b/spec/classes/ceilometer_db_spec.rb deleted file mode 100644 index f48b60da..00000000 --- a/spec/classes/ceilometer_db_spec.rb +++ /dev/null @@ -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 => '', - :connection => 'mysql+pymysql://ceilometer:ceilometer@localhost/ceilometer', - :connection_recycle_time => '', - :max_pool_size => '', - :max_retries => '', - :retry_interval => '', - :max_overflow => '', - :pool_timeout => '', - :mysql_enable_ndb => '', - )} - - 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