diff --git a/manifests/ceilometer.pp b/manifests/ceilometer.pp index c13374b3..92e2aa32 100644 --- a/manifests/ceilometer.pp +++ b/manifests/ceilometer.pp @@ -17,7 +17,7 @@ class cinder::ceilometer ( $notification_driver = 'messagingv2', ) { - cinder_config { - 'DEFAULT/notification_driver': value => $notification_driver; + oslo::messaging::notifications { 'cinder_config': + driver => $notification_driver } } diff --git a/manifests/db.pp b/manifests/db.pp index 0c35d6b4..1e0f9a43 100644 --- a/manifests/db.pp +++ b/manifests/db.pp @@ -43,8 +43,6 @@ class cinder::db ( $database_max_overflow = $::os_service_default, ) { - include ::cinder::params - # NOTE(spredzy): In order to keep backward compatibility we rely on the pick function # to use cinder:: if cinder::db:: isn't specified. $database_connection_real = pick($::cinder::database_connection,$database_connection) @@ -58,44 +56,13 @@ class cinder::db ( validate_re($database_connection_real, '^(sqlite|mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?') - case $database_connection_real { - /^mysql(\+pymysql)?:\/\//: { - require 'mysql::bindings' - require 'mysql::bindings::python' - if $database_connection_real =~ /^mysql\+pymysql/ { - $backend_package = $::cinder::params::pymysql_package_name - } else { - $backend_package = false - } - } - /^postgresql:\/\//: { - $backend_package = false - require 'postgresql::lib::python' - } - /^sqlite:\/\//: { - $backend_package = $::cinder::params::sqlite_package_name - } - default: { - fail('Unsupported backend configured') - } + oslo::db { 'cinder_config': + connection => $database_connection_real, + idle_timeout => $database_idle_timeout_real, + min_pool_size => $database_min_pool_size_real, + max_pool_size => $database_max_pool_size_real, + max_retries => $database_max_retries_real, + retry_interval => $database_retry_interval_real, + max_overflow => $database_max_overflow_real, } - - if $backend_package and !defined(Package[$backend_package]) { - package {'cinder-backend-package': - ensure => present, - name => $backend_package, - tag => 'openstack', - } - } - - cinder_config { - 'database/connection': value => $database_connection_real, secret => true; - 'database/idle_timeout': value => $database_idle_timeout_real; - 'database/min_pool_size': value => $database_min_pool_size_real; - 'database/max_retries': value => $database_max_retries_real; - 'database/retry_interval': value => $database_retry_interval_real; - 'database/max_pool_size': value => $database_max_pool_size_real; - 'database/max_overflow': value => $database_max_overflow_real; - } - } diff --git a/manifests/init.pp b/manifests/init.pp index 0f671ada..b74ac344 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -363,45 +363,33 @@ class cinder ( fail('Please specify a rabbit_password parameter.') } + oslo::messaging::rabbit { 'cinder_config': + rabbit_userid => $rabbit_userid, + rabbit_password => $rabbit_password, + rabbit_virtual_host => $rabbit_virtual_host, + rabbit_host => $rabbit_host, + rabbit_port => $rabbit_port, + rabbit_hosts => $rabbit_hosts, + rabbit_ha_queues => $rabbit_ha_queues, + heartbeat_timeout_threshold => $rabbit_heartbeat_timeout_threshold, + heartbeat_rate => $rabbit_heartbeat_rate, + rabbit_use_ssl => $rabbit_use_ssl, + kombu_reconnect_delay => $kombu_reconnect_delay, + kombu_ssl_version => $kombu_ssl_version, + kombu_ssl_keyfile => $kombu_ssl_keyfile, + kombu_ssl_certfile => $kombu_ssl_certfile, + kombu_ssl_ca_certs => $kombu_ssl_ca_certs, + amqp_durable_queues => $amqp_durable_queues, + } + + oslo::messaging::default { 'cinder_config': + control_exchange => $control_exchange + } + cinder_config { - 'oslo_messaging_rabbit/rabbit_password': value => $rabbit_password, secret => true; - 'oslo_messaging_rabbit/rabbit_userid': value => $rabbit_userid; - 'oslo_messaging_rabbit/rabbit_virtual_host': value => $rabbit_virtual_host; - 'oslo_messaging_rabbit/rabbit_use_ssl': value => $rabbit_use_ssl; - 'oslo_messaging_rabbit/kombu_ssl_version': value => $kombu_ssl_version; - 'oslo_messaging_rabbit/kombu_ssl_ca_certs': value => $kombu_ssl_ca_certs; - 'oslo_messaging_rabbit/kombu_ssl_certfile': value => $kombu_ssl_certfile; - 'oslo_messaging_rabbit/kombu_ssl_keyfile': value => $kombu_ssl_keyfile; - 'oslo_messaging_rabbit/kombu_reconnect_delay': value => $kombu_reconnect_delay; - 'oslo_messaging_rabbit/heartbeat_timeout_threshold': value => $rabbit_heartbeat_timeout_threshold; - 'oslo_messaging_rabbit/heartbeat_rate': value => $rabbit_heartbeat_rate; - 'DEFAULT/control_exchange': value => $control_exchange; - 'DEFAULT/report_interval': value => $report_interval; - 'DEFAULT/service_down_time': value => $service_down_time; - 'oslo_messaging_rabbit/amqp_durable_queues': value => $amqp_durable_queues; + 'DEFAULT/report_interval': value => $report_interval; + 'DEFAULT/service_down_time': value => $service_down_time; } - - if $rabbit_hosts { - cinder_config { 'oslo_messaging_rabbit/rabbit_hosts': value => join(any2array($rabbit_hosts), ',') } - cinder_config { 'oslo_messaging_rabbit/rabbit_host': ensure => absent } - cinder_config { 'oslo_messaging_rabbit/rabbit_port': ensure => absent } - } else { - cinder_config { 'oslo_messaging_rabbit/rabbit_host': value => $rabbit_host } - cinder_config { 'oslo_messaging_rabbit/rabbit_port': value => $rabbit_port } - cinder_config { 'oslo_messaging_rabbit/rabbit_hosts': value => "${rabbit_host}:${rabbit_port}" } - } - - # By default rabbit_ha_queues is undef - if $rabbit_ha_queues == undef { - if size($rabbit_hosts) > 1 { - cinder_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => true } - } else { - cinder_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false } - } - } else { - cinder_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => $rabbit_ha_queues } - } - } if $rpc_backend == 'cinder.openstack.common.rpc.impl_qpid' or $rpc_backend == 'qpid' { @@ -416,7 +404,6 @@ class cinder ( cinder_config { 'DEFAULT/api_paste_config': value => $api_paste_config; - 'DEFAULT/rpc_backend': value => $rpc_backend; 'DEFAULT/storage_availability_zone': value => $storage_availability_zone; 'DEFAULT/default_availability_zone': value => $default_availability_zone_real; 'DEFAULT/image_conversion_dir': value => $image_conversion_dir; @@ -443,7 +430,9 @@ class cinder ( 'DEFAULT/enable_v1_api': value => $enable_v1_api; 'DEFAULT/enable_v2_api': value => $enable_v2_api; 'DEFAULT/enable_v3_api': value => $enable_v3_api; - 'oslo_concurrency/lock_path': value => $lock_path; } + oslo::concurrency { 'cinder_config': + lock_path => $lock_path + } } diff --git a/manifests/logging.pp b/manifests/logging.pp index 6623cf24..769fb84a 100644 --- a/manifests/logging.pp +++ b/manifests/logging.pp @@ -120,30 +120,23 @@ class cinder::logging( $verbose_real = pick($::cinder::verbose,$verbose) $debug_real = pick($::cinder::debug,$debug) - if is_service_default($default_log_levels) { - $default_log_levels_real = $default_log_levels - } else { - $default_log_levels_real = join(sort(join_keys_to_values($default_log_levels, '=')), ',') + oslo::log { 'cinder_config': + debug => $debug_real, + verbose => $verbose_real, + use_syslog => $use_syslog_real, + use_stderr => $use_stderr_real, + log_dir => $log_dir_real, + syslog_log_facility => $log_facility_real, + logging_context_format_string => $logging_context_format_string, + logging_default_format_string => $logging_default_format_string, + logging_debug_format_suffix => $logging_debug_format_suffix, + logging_exception_prefix => $logging_exception_prefix, + log_config_append => $log_config_append, + default_log_levels => $default_log_levels, + publish_errors => $publish_errors, + fatal_deprecations => $fatal_deprecations, + log_date_format => $log_date_format, + instance_format => $instance_format, + instance_uuid_format => $instance_uuid_format, } - - cinder_config { - 'DEFAULT/use_syslog' : value => $use_syslog_real; - 'DEFAULT/use_stderr' : value => $use_stderr_real; - 'DEFAULT/syslog_log_facility' : value => $log_facility_real; - 'DEFAULT/log_dir' : value => $log_dir_real; - 'DEFAULT/verbose' : value => $verbose_real; - 'DEFAULT/debug' : value => $debug_real; - 'DEFAULT/default_log_levels' : value => $default_log_levels_real; - 'DEFAULT/logging_context_format_string' : value => $logging_context_format_string; - 'DEFAULT/logging_default_format_string' : value => $logging_default_format_string; - 'DEFAULT/logging_debug_format_suffix' : value => $logging_debug_format_suffix; - 'DEFAULT/logging_exception_prefix' : value => $logging_exception_prefix; - 'DEFAULT/log_config_append' : value => $log_config_append; - 'DEFAULT/publish_errors' : value => $publish_errors; - 'DEFAULT/fatal_deprecations' : value => $fatal_deprecations; - 'DEFAULT/instance_format' : value => $instance_format; - 'DEFAULT/instance_uuid_format' : value => $instance_uuid_format; - 'DEFAULT/log_date_format' : value => $log_date_format; - } - } diff --git a/manifests/params.pp b/manifests/params.pp index 8d2c6db0..1965df4d 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -20,8 +20,6 @@ class cinder::params { $iscsi_helper = 'tgtadm' $lio_package_name = 'targetcli' $lock_path = '/var/lock/cinder' - $sqlite_package_name = 'python-pysqlite2' - $pymysql_package_name = 'python-pymysql' } elsif($::osfamily == 'RedHat') { @@ -41,8 +39,6 @@ class cinder::params { $ceph_init_override = '/etc/sysconfig/openstack-cinder-volume' $lio_package_name = 'targetcli' $lock_path = '/var/lib/cinder/tmp' - $sqlite_package_name = undef - $pymysql_package_name = undef case $::operatingsystem { 'RedHat', 'CentOS', 'Scientific', 'OracleLinux': { diff --git a/manifests/policy.pp b/manifests/policy.pp index 9abaeb4e..56a0bced 100644 --- a/manifests/policy.pp +++ b/manifests/policy.pp @@ -29,5 +29,5 @@ class cinder::policy ( } create_resources('openstacklib::policy::base', $policies) - + oslo::policy { 'cinder_config': policy_file => $policy_path } } diff --git a/metadata.json b/metadata.json index 73f12617..c4d74fe1 100644 --- a/metadata.json +++ b/metadata.json @@ -36,6 +36,7 @@ { "name": "openstack/keystone", "version_requirement": ">=8.0.0 <9.0.0" }, { "name": "puppetlabs/rabbitmq", "version_requirement": ">=2.0.2 <6.0.0" }, { "name": "puppetlabs/stdlib", "version_requirement": ">=4.0.0 <5.0.0" }, - { "name": "openstack/openstacklib", "version_requirement": ">=8.0.0 <9.0.0" } + { "name": "openstack/openstacklib", "version_requirement": ">=8.0.0 <9.0.0" }, + { "name": "openstack/oslo", "version_requirement": "<9.0.0" } ] } diff --git a/releasenotes/notes/switch_to_oslo-0c527b4a9d4d5c93.yaml b/releasenotes/notes/switch_to_oslo-0c527b4a9d4d5c93.yaml new file mode 100644 index 00000000..fc6923a0 --- /dev/null +++ b/releasenotes/notes/switch_to_oslo-0c527b4a9d4d5c93.yaml @@ -0,0 +1,4 @@ +--- +features: + - Switch to puppet-oslo resource usage (instead of + manual configuration file editing). diff --git a/spec/classes/cinder_ceilometer_spec.rb b/spec/classes/cinder_ceilometer_spec.rb index 1d268c1a..9e8dcefe 100644 --- a/spec/classes/cinder_ceilometer_spec.rb +++ b/spec/classes/cinder_ceilometer_spec.rb @@ -4,7 +4,7 @@ describe 'cinder::ceilometer' do describe 'with default parameters' do it 'contains default values' do - is_expected.to contain_cinder_config('DEFAULT/notification_driver').with( + is_expected.to contain_cinder_config('oslo_messaging_notifications/driver').with( :value => 'messagingv2') end end diff --git a/spec/classes/cinder_db_spec.rb b/spec/classes/cinder_db_spec.rb index daaad619..f279a276 100644 --- a/spec/classes/cinder_db_spec.rb +++ b/spec/classes/cinder_db_spec.rb @@ -84,7 +84,7 @@ describe 'cinder::db' do end it 'install the proper backend package' do - is_expected.to contain_package('cinder-backend-package').with( + is_expected.to contain_package('db_backend_package').with( :ensure => 'present', :name => 'python-pymysql', :tag => 'openstack' @@ -108,7 +108,7 @@ describe 'cinder::db' do { :database_connection => 'mysql+pymysql://cinder:cinder@localhost/cinder', } end - it { is_expected.not_to contain_package('cinder-backend-package') } + it { is_expected.not_to contain_package('db_backend_package') } end end diff --git a/spec/classes/cinder_policy_spec.rb b/spec/classes/cinder_policy_spec.rb index 24229e76..938f0c88 100644 --- a/spec/classes/cinder_policy_spec.rb +++ b/spec/classes/cinder_policy_spec.rb @@ -20,6 +20,7 @@ describe 'cinder::policy' do :key => 'context_is_admin', :value => 'foo:bar' }) + is_expected.to contain_cinder_config('oslo_policy/policy_file').with_value('/etc/cinder/policy.json') end end diff --git a/spec/classes/cinder_spec.rb b/spec/classes/cinder_spec.rb index b7855dec..9203aff3 100644 --- a/spec/classes/cinder_spec.rb +++ b/spec/classes/cinder_spec.rb @@ -33,8 +33,8 @@ describe 'cinder' do is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_password').with(:value => 'guest', :secret => true) is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_host').with(:value => '127.0.0.1') is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_port').with(:value => '5672') - is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_hosts').with(:value => '127.0.0.1:5672') - is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_ha_queues').with(:value => false) + is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_hosts').with(:value => '') + is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_ha_queues').with(:value => '') is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_virtual_host').with(:value => '/') is_expected.to contain_cinder_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('0') is_expected.to contain_cinder_config('oslo_messaging_rabbit/heartbeat_rate').with_value('2') @@ -53,8 +53,8 @@ describe 'cinder' do end it 'should contain many' do - is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_host').with(:value => nil) - is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_port').with(:value => nil) + is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_host').with(:value => '') + is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_port').with(:value => '') is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_hosts').with(:value => 'rabbit1:5672,rabbit2:5672') is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_ha_queues').with(:value => true) end @@ -66,10 +66,10 @@ describe 'cinder' do end it 'should contain many' do - is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_host').with(:value => nil) - is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_port').with(:value => nil) + is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_host').with(:value => '') + is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_port').with(:value => '') is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_hosts').with(:value => 'rabbit1:5672') - is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_ha_queues').with(:value => false) + is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_ha_queues').with(:value => '') end end