Update Cinder for using puppet-oslo

This commit switches using of oslo options to a puppet-oslo module:
* oslo messaging notifications;
* oslo messaging rabbitmq;
* oslo log;
* oslo db;
* oslo policy;

Change-Id: I48e77630c7def069d3f27e55bcd402740e8eddc5
This commit is contained in:
Denis Egorenko 2016-03-29 15:39:01 +03:00
parent 7007ed22b7
commit 35bedf78c8
12 changed files with 74 additions and 123 deletions

View File

@ -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
}
}

View File

@ -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::<myparam> if cinder::db::<myparam> 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;
}
}

View File

@ -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
}
}

View File

@ -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;
}
}

View File

@ -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': {

View File

@ -29,5 +29,5 @@ class cinder::policy (
}
create_resources('openstacklib::policy::base', $policies)
oslo::policy { 'cinder_config': policy_file => $policy_path }
}

View File

@ -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" }
]
}

View File

@ -0,0 +1,4 @@
---
features:
- Switch to puppet-oslo resource usage (instead of
manual configuration file editing).

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 => '<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_ha_queues').with(:value => '<SERVICE DEFAULT>')
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 => '<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_port').with(:value => '<SERVICE DEFAULT>')
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 => '<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_port').with(:value => '<SERVICE DEFAULT>')
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 => '<SERVICE DEFAULT>')
end
end