Add syslog support to openstack::compute

Change-Id: I20072f2e5cb06422b68347cc9d96cb6ee0d5532a
This commit is contained in:
Francois Deppierraz 2013-10-29 16:13:36 +01:00
parent 0f053d68bc
commit d001af0910
4 changed files with 75 additions and 3 deletions

View File

@ -17,6 +17,8 @@ class openstack::cinder::storage(
$volume_driver = 'iscsi',
$iscsi_ip_address = '127.0.0.1',
$setup_test_volume = false,
$use_syslog = false,
$log_facility = 'LOG_USER',
$debug = false,
$verbose = false
) {
@ -31,6 +33,8 @@ class openstack::cinder::storage(
rabbit_virtual_host => $rabbit_virtual_host,
package_ensure => $package_ensure,
api_paste_config => $api_paste_config,
use_syslog => $use_syslog,
log_facility => $log_facility,
debug => $debug,
verbose => $verbose,
}

View File

@ -18,6 +18,14 @@
# [rabbit_hosts] An array of IP addresses or Virttual IP address for connecting to a RabbitMQ Cluster.
# Optional. Defaults to false.
#
# [use_syslog]
# Use syslog for logging.
# (Optional) Defaults to false.
#
# [log_facility]
# Syslog facility to receive log lines.
# (Optional) Defaults to LOG_USER.
#
# === Examples
#
# class { 'openstack::compute':
@ -98,6 +106,8 @@ class openstack::compute (
$migration_support = false,
$verbose = false,
$force_config_drive = false,
$use_syslog = false,
$log_facility = 'LOG_USER',
$enabled = true
) {
@ -138,6 +148,8 @@ class openstack::compute (
rabbit_host => $rabbit_host,
rabbit_hosts => $rabbit_hosts,
rabbit_virtual_host => $rabbit_virtual_host,
use_syslog => $use_syslog,
log_facility => $log_facility,
}
# Install / configure nova-compute
@ -235,7 +247,9 @@ class openstack::compute (
enable_server => false,
verbose => $verbose,
bridge_mappings => $bridge_mappings,
bridge_uplinks => $bridge_uplinks
bridge_uplinks => $bridge_uplinks,
use_syslog => $use_syslog,
log_facility => $log_facility,
}
class { 'nova::compute::neutron':
@ -279,6 +293,8 @@ class openstack::compute (
rbd_pool => $cinder_rbd_pool,
rbd_secret_uuid => $cinder_rbd_secret_uuid,
volume_driver => $cinder_volume_driver,
use_syslog => $use_syslog,
log_facility => $log_facility,
}
# set in nova::api

View File

@ -24,6 +24,8 @@ describe 'openstack::cinder::storage' do
:rabbit_virtual_host => '/',
:package_ensure => 'present',
:api_paste_config => '/etc/cinder/api-paste.ini',
:use_syslog => false,
:log_facility => 'LOG_USER',
:debug => false,
:verbose => false
)
@ -84,4 +86,18 @@ describe 'openstack::cinder::storage' do
end
describe 'with custom syslog parameters' do
before do
params.merge!(
:use_syslog => true,
:log_facility => 'LOG_LOCAL0'
)
end
it { should contain_class('cinder').with(
:use_syslog => true,
:log_facility => 'LOG_LOCAL0'
) }
end
end

View File

@ -39,6 +39,8 @@ describe 'openstack::compute' do
:rabbit_virtual_host => '/',
:image_service => 'nova.image.glance.GlanceImageService',
:glance_api_servers => false,
:use_syslog => false,
:log_facility => 'LOG_USER',
:verbose => false
)
should_not contain_resources('nova_config').with_purge(true)
@ -81,7 +83,9 @@ describe 'openstack::compute' do
:enabled => true,
:verbose => false,
:setup_test_volume => false,
:volume_driver => 'iscsi'
:volume_driver => 'iscsi',
:use_syslog => false,
:log_facility => 'LOG_USER'
)
}
end
@ -178,7 +182,9 @@ describe 'openstack::compute' do
:setup_test_volume => false,
:rbd_user => 'volumes',
:rbd_pool => 'volumes',
:volume_driver => 'rbd'
:volume_driver => 'rbd',
:use_syslog => false,
:log_facility => 'LOG_USER'
)
end
end
@ -305,6 +311,8 @@ describe 'openstack::compute' do
:keystone_host => params[:keystone_host],
:enabled => true,
:enable_server => false,
:use_syslog => false,
:log_facility => 'LOG_USER',
:verbose => false
)
@ -329,4 +337,32 @@ describe 'openstack::compute' do
end
end
describe 'with custom syslog settings' do
before do
params.merge!({
:use_syslog => true,
:log_facility => 'LOG_LOCAL0',
:neutron => true,
:neutron_user_password => 'foobar'
})
end
it do
should contain_class('nova').with(
:use_syslog => true,
:log_facility => 'LOG_LOCAL0'
)
should contain_class('openstack::neutron').with(
:use_syslog => true,
:log_facility => 'LOG_LOCAL0'
)
should contain_class('openstack::cinder::storage').with(
:use_syslog => true,
:log_facility => 'LOG_LOCAL0'
)
end
end
end