Configure oslo related sections using puppet-oslo module

Database, logging, policy and notification parameters are
configured from oslo defines now.

Change-Id: I33869211a9ebc4bfc42452b2926788f68396e892
This commit is contained in:
iberezovskiy 2016-04-07 18:14:53 +03:00
parent 94c3bbed71
commit 0891c39e1f
8 changed files with 51 additions and 92 deletions

View File

@ -93,50 +93,16 @@ class nova::db (
if !is_service_default($database_connection_real) {
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 = $::nova::params::pymysql_package_name
} else {
$backend_package = false
}
}
/^postgresql:\/\//: {
$backend_package = false
require 'postgresql::lib::python'
}
/^sqlite:\/\//: {
$backend_package = $::nova::params::sqlite_package_name
}
default: {
fail('Unsupported backend configured')
}
oslo::db { 'nova_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,
slave_connection => $slave_connection_real,
}
if $backend_package and !defined(Package[$backend_package]) {
package {'nova-backend-package':
ensure => present,
name => $backend_package,
tag => ['openstack', 'nova-package'],
}
}
nova_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;
'database/slave_connection': value => $slave_connection_real, secret => true;
}
}
if !is_service_default($api_database_connection_real) {

View File

@ -239,11 +239,11 @@
# [*notification_driver*]
# (optional) Driver or drivers to handle sending notifications.
# Value can be a string or a list.
# Defaults to undef
# Defaults to $::os_service_default.
#
# [*notification_topics*]
# (optional) AMQP topic used for OpenStack notifications
# Defaults to 'notifications'
# Defaults to ::os_service_default
#
# [*notify_api_faults*]
# (optional) If set, send api.fault notifications on caught
@ -404,8 +404,8 @@ class nova(
$use_syslog = undef,
$use_stderr = undef,
$log_facility = undef,
$notification_driver = undef,
$notification_topics = 'notifications',
$notification_driver = $::os_service_default,
$notification_topics = $::os_service_default,
$notify_api_faults = false,
$notify_on_state_change = undef,
$os_region_name = undef,
@ -599,27 +599,24 @@ class nova(
}
}
if $notification_driver {
nova_config {
'DEFAULT/notification_driver': value => join(any2array($notification_driver), ',');
}
} else {
nova_config { 'DEFAULT/notification_driver': ensure => absent; }
oslo::messaging::notifications { 'nova_config':
driver => $notification_driver,
topics => $notification_topics,
}
nova_config {
'cinder/catalog_info': value => $cinder_catalog_info;
'DEFAULT/notification_topics': value => $notification_topics;
'DEFAULT/notify_api_faults': value => $notify_api_faults;
# Following may need to be broken out to different nova services
'DEFAULT/state_path': value => $state_path;
'oslo_concurrency/lock_path': value => $lock_path;
'DEFAULT/service_down_time': value => $service_down_time;
'DEFAULT/rootwrap_config': value => $rootwrap_config;
'DEFAULT/report_interval': value => $report_interval;
'DEFAULT/use_ipv6': value => $use_ipv6;
}
oslo::concurrency { 'nova_config': lock_path => $lock_path }
if $notify_on_state_change and $notify_on_state_change in ['vm_state', 'vm_and_task_state'] {
nova_config {
'DEFAULT/notify_on_state_change': value => $notify_on_state_change;

View File

@ -121,31 +121,25 @@ class nova::logging(
$verbose_real = pick($::nova::verbose,$verbose)
$debug_real = pick($::nova::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, '=')), ',')
}
nova_config {
'DEFAULT/debug': value => $debug_real;
'DEFAULT/verbose': value => $verbose_real;
'DEFAULT/use_stderr': value => $use_stderr_real;
'DEFAULT/use_syslog': value => $use_syslog_real;
'DEFAULT/log_dir': value => $log_dir_real;
'DEFAULT/syslog_log_facility': value => $log_facility_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/default_log_levels': value => $default_log_levels_real;
'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;
oslo::log { 'nova_config':
debug => $debug_real,
verbose => $verbose_real,
use_stderr => $use_stderr_real,
use_syslog => $use_syslog_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,
instance_format => $instance_format,
instance_uuid_format => $instance_uuid_format,
log_date_format => $log_date_format,
}
}

View File

@ -26,8 +26,6 @@ class nova::params {
$vncproxy_package_name = 'openstack-nova-novncproxy'
$serialproxy_package_name = 'openstack-nova-serialproxy'
$spicehtml5proxy_package_name = 'openstack-nova-console'
$sqlite_package_name = undef
$pymysql_package_name = undef
$ceph_client_package_name = 'ceph-common'
$genisoimage_package_name = 'genisoimage'
# service names
@ -86,8 +84,6 @@ class nova::params {
$scheduler_package_name = 'nova-scheduler'
$tgt_package_name = 'tgt'
$serialproxy_package_name = 'nova-serialproxy'
$sqlite_package_name = 'python-pysqlite2'
$pymysql_package_name = 'python-pymysql'
$ceph_client_package_name = 'ceph'
$genisoimage_package_name = 'genisoimage'
# service names

View File

@ -38,4 +38,6 @@ class nova::policy (
create_resources('openstacklib::policy::base', $policies, $policy_defaults)
oslo::policy { 'nova_config': policy_file => $policy_path }
}

View File

@ -0,0 +1,5 @@
---
features:
- Configure oslo related sections using puppet-oslo module.
Database, logging, policy and notification parameters are
configured from oslo defines now.

View File

@ -92,10 +92,10 @@ describe 'nova::db' do
{ :database_connection => 'mysql+pymysql://user:pass@db/db', }
end
it 'install the proper backend package' do
is_expected.to contain_package('nova-backend-package').with(
is_expected.to contain_package('db_backend_package').with(
:ensure => 'present',
:name => 'python-pymysql',
:tag => ['openstack', 'nova-package'],
:tag => ['openstack'],
)
end
end
@ -106,10 +106,10 @@ describe 'nova::db' do
end
it 'install the proper backend package' do
is_expected.to contain_package('nova-backend-package').with(
is_expected.to contain_package('db_backend_package').with(
:ensure => 'present',
:name => 'python-pysqlite2',
:tag => ['openstack', 'nova-package'],
:tag => ['openstack'],
)
end
@ -131,7 +131,7 @@ describe 'nova::db' do
{ :database_connection => 'mysql+pymysql://user:pass@db/db', }
end
it { is_expected.not_to contain_package('nova-backend-package') }
it { is_expected.not_to contain_package('db_backend_package') }
end
end

View File

@ -56,7 +56,6 @@ describe 'nova' do
is_expected.to contain_nova_config('DEFAULT/state_path').with_value('/var/lib/nova')
is_expected.to contain_nova_config('oslo_concurrency/lock_path').with_value(platform_params[:lock_path])
is_expected.to contain_nova_config('DEFAULT/service_down_time').with_value('60')
is_expected.to contain_nova_config('DEFAULT/notification_driver').with_ensure('absent')
is_expected.to contain_nova_config('DEFAULT/rootwrap_config').with_value('/etc/nova/rootwrap.conf')
is_expected.to contain_nova_config('DEFAULT/report_interval').with_value('10')
is_expected.to contain_nova_config('DEFAULT/use_ipv6').with_value('<SERVICE DEFAULT>')
@ -160,8 +159,8 @@ describe 'nova' do
is_expected.to contain_nova_config('DEFAULT/state_path').with_value('/var/lib/nova2')
is_expected.to contain_nova_config('oslo_concurrency/lock_path').with_value('/var/locky/path')
is_expected.to contain_nova_config('DEFAULT/service_down_time').with_value('120')
is_expected.to contain_nova_config('DEFAULT/notification_driver').with_value('ceilometer.compute.nova_notifier')
is_expected.to contain_nova_config('DEFAULT/notification_topics').with_value('openstack')
is_expected.to contain_nova_config('oslo_messaging_notifications/driver').with_value('ceilometer.compute.nova_notifier')
is_expected.to contain_nova_config('oslo_messaging_notifications/topics').with_value('openstack')
is_expected.to contain_nova_config('DEFAULT/notify_api_faults').with_value(true)
is_expected.to contain_nova_config('DEFAULT/report_interval').with_value('60')
is_expected.to contain_nova_config('DEFAULT/use_ipv6').with_value('true')
@ -177,7 +176,7 @@ describe 'nova' do
context 'with multiple notification_driver' do
before { params.merge!( :notification_driver => ['ceilometer.compute.nova_notifier', 'nova.openstack.common.notifier.rpc_notifier']) }
it { is_expected.to contain_nova_config('DEFAULT/notification_driver').with_value(
it { is_expected.to contain_nova_config('oslo_messaging_notifications/driver').with_value(
'ceilometer.compute.nova_notifier,nova.openstack.common.notifier.rpc_notifier'
) }
end