Add syslog support to the openstack module
This change depends on the syslog implementation in all other dependent
modules.
Conflicts:
manifests/cinder/all.pp
manifests/controller.pp
manifests/keystone.pp
spec/classes/openstack_cinder_all_spec.rb
spec/classes/openstack_controller_spec.rb
spec/classes/openstack_keystone_spec.rb
Cherry-picked from 9cda7a373b in master.
Change-Id: Id500009a5308100775f1a35e20f7c089ff5a319b
This commit is contained in:
@@ -33,6 +33,8 @@ class openstack::cinder::all(
|
||||
$rbd_secret_uuid = false,
|
||||
$setup_test_volume = false,
|
||||
$manage_volumes = true,
|
||||
$use_syslog = false,
|
||||
$log_facility = 'LOG_USER',
|
||||
$verbose = false
|
||||
) {
|
||||
|
||||
@@ -55,6 +57,8 @@ class openstack::cinder::all(
|
||||
rabbit_virtual_host => $rabbit_virtual_host,
|
||||
package_ensure => $package_ensure,
|
||||
api_paste_config => $api_paste_config,
|
||||
use_syslog => $use_syslog,
|
||||
log_facility => $log_facility,
|
||||
verbose => $verbose,
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,8 @@ class openstack::cinder::controller(
|
||||
$scheduler_driver = 'cinder.scheduler.simple.SimpleScheduler',
|
||||
$api_enabled = true,
|
||||
$scheduler_enabled = true,
|
||||
$use_syslog = false,
|
||||
$log_facility = 'LOG_USER',
|
||||
$debug = false,
|
||||
$verbose = false
|
||||
) {
|
||||
@@ -53,6 +55,8 @@ class openstack::cinder::controller(
|
||||
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,
|
||||
}
|
||||
|
||||
@@ -125,6 +125,14 @@
|
||||
# The swift admin endpoint address used to populate the keystone service catalog.
|
||||
# (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::controller':
|
||||
@@ -265,6 +273,9 @@ class openstack::controller (
|
||||
$swift_public_address = false,
|
||||
$swift_internal_address = false,
|
||||
$swift_admin_address = false,
|
||||
# Syslog
|
||||
$use_syslog = false,
|
||||
$log_facility = 'LOG_USER',
|
||||
$enabled = true
|
||||
) {
|
||||
|
||||
@@ -371,6 +382,8 @@ class openstack::controller (
|
||||
swift_admin_address => $swift_admin_address,
|
||||
enabled => $enabled,
|
||||
bind_host => $keystone_bind_address,
|
||||
use_syslog => $use_syslog,
|
||||
log_facility => $log_facility,
|
||||
}
|
||||
|
||||
|
||||
@@ -392,6 +405,8 @@ class openstack::controller (
|
||||
swift_store_key => $swift_store_key,
|
||||
rbd_store_user => $glance_rbd_store_user,
|
||||
rbd_store_pool => $glance_rbd_store_pool,
|
||||
use_syslog => $use_syslog,
|
||||
log_facility => $log_facility,
|
||||
enabled => $enabled,
|
||||
}
|
||||
|
||||
@@ -452,6 +467,9 @@ class openstack::controller (
|
||||
# VNC
|
||||
vnc_enabled => $vnc_enabled,
|
||||
vncproxy_host => $vncproxy_host_real,
|
||||
# Syslog
|
||||
use_syslog => $use_syslog,
|
||||
log_facility => $log_facility,
|
||||
# General
|
||||
debug => $debug,
|
||||
verbose => $verbose,
|
||||
@@ -519,6 +537,9 @@ class openstack::controller (
|
||||
shared_secret => $metadata_shared_secret,
|
||||
# Keystone
|
||||
keystone_host => $keystone_host,
|
||||
# Syslog
|
||||
use_syslog => $use_syslog,
|
||||
log_facility => $log_facility,
|
||||
# General
|
||||
enabled => $enabled,
|
||||
enable_server => $enable_quantum_server,
|
||||
@@ -554,6 +575,8 @@ class openstack::controller (
|
||||
db_host => $db_host,
|
||||
api_enabled => $enabled,
|
||||
scheduler_enabled => $enabled,
|
||||
use_syslog => $use_syslog,
|
||||
log_facility => $log_facility,
|
||||
debug => $debug,
|
||||
verbose => $verbose
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
# [swift_store_auth_addres] The URL where the Swift auth service lives. Defaults to "http://${keystone_host}:5000/v2.0/"
|
||||
# [verbose] Log verbosely. Optional. Defaults to false.
|
||||
# [debug] Log at a debug-level. Optional. Defaults to false.
|
||||
# [use_syslog] Use syslog for logging. Optional. Defaults to false.
|
||||
# [syslog_facility] Syslog facility to receive log lines. Optional. Defaults to LOG_USER.
|
||||
# [enabled] Used to indicate if the service should be active (true) or passive (false).
|
||||
# Optional. Defaults to true
|
||||
#
|
||||
@@ -58,6 +60,8 @@ class openstack::glance (
|
||||
$rbd_store_pool = 'images',
|
||||
$verbose = false,
|
||||
$debug = false,
|
||||
$use_syslog = false,
|
||||
$log_facility = 'LOG_USER',
|
||||
$enabled = true
|
||||
) {
|
||||
|
||||
@@ -82,6 +86,8 @@ class openstack::glance (
|
||||
keystone_password => $user_password,
|
||||
sql_connection => $sql_connection,
|
||||
sql_idle_timeout => $sql_idle_timeout,
|
||||
use_syslog => $use_syslog,
|
||||
log_facility => $log_facility,
|
||||
enabled => $enabled,
|
||||
}
|
||||
|
||||
@@ -98,6 +104,8 @@ class openstack::glance (
|
||||
keystone_password => $user_password,
|
||||
sql_connection => $sql_connection,
|
||||
sql_idle_timeout => $sql_idle_timeout,
|
||||
use_syslog => $use_syslog,
|
||||
log_facility => $log_facility,
|
||||
enabled => $enabled,
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
# [swift_user_password]
|
||||
# Auth password for swift.
|
||||
# (Optional) Defaults to false.
|
||||
# [use_syslog] Use syslog for logging. Defaults to false.
|
||||
# [log_facility] Syslog facility to receive log lines. Defaults to LOG_USER.
|
||||
# [enabled] If the service is active (true) or passive (false).
|
||||
# Optional. Defaults to true
|
||||
#
|
||||
@@ -98,6 +100,8 @@ class openstack::keystone (
|
||||
$cinder = true,
|
||||
$quantum = true,
|
||||
$swift = false,
|
||||
$use_syslog = false,
|
||||
$log_facility = 'LOG_USER',
|
||||
$enabled = true
|
||||
) {
|
||||
|
||||
@@ -207,6 +211,8 @@ class openstack::keystone (
|
||||
token_format => $token_format,
|
||||
enabled => $enabled,
|
||||
sql_connection => $sql_conn,
|
||||
use_syslog => $use_syslog,
|
||||
log_facility => $log_facility,
|
||||
}
|
||||
|
||||
if ($enabled) {
|
||||
|
||||
@@ -36,6 +36,14 @@
|
||||
# Timeout for sql to reap connections.
|
||||
# (Optional) Defaults to '3600'.
|
||||
#
|
||||
# [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::nova::controller':
|
||||
@@ -98,6 +106,9 @@ class openstack::nova::controller (
|
||||
$vncproxy_host = undef,
|
||||
# Keystone
|
||||
$keystone_host = '127.0.0.1',
|
||||
# Syslog
|
||||
$use_syslog = false,
|
||||
$log_facility = 'LOG_USER',
|
||||
# General
|
||||
$debug = false,
|
||||
$verbose = false,
|
||||
@@ -151,6 +162,8 @@ class openstack::nova::controller (
|
||||
verbose => $verbose,
|
||||
rabbit_host => $rabbit_connection,
|
||||
rabbit_hosts => $rabbit_hosts,
|
||||
use_syslog => $use_syslog,
|
||||
log_facility => $log_facility,
|
||||
}
|
||||
|
||||
# Configure nova-api
|
||||
|
||||
@@ -129,6 +129,14 @@
|
||||
# Host running keystone.
|
||||
# (optional) Defaults to 127.0.0.1.
|
||||
#
|
||||
# [use_syslog]
|
||||
# Use syslog for logging.
|
||||
# (optional) Default to false.
|
||||
#
|
||||
# [log_facility]
|
||||
# Syslog facility to receive log lines.
|
||||
# (optional) Default to LOG_USER.
|
||||
#
|
||||
# [verbose]
|
||||
# Enables verbose for quantum services.
|
||||
# (optional) Defaults to false.
|
||||
@@ -194,6 +202,8 @@ class openstack::quantum (
|
||||
# General
|
||||
$bind_address = '0.0.0.0',
|
||||
$keystone_host = '127.0.0.1',
|
||||
$use_syslog = false,
|
||||
$log_facility = 'LOG_USER',
|
||||
$verbose = false,
|
||||
$debug = false,
|
||||
) {
|
||||
@@ -207,6 +217,8 @@ class openstack::quantum (
|
||||
rabbit_virtual_host => $rabbit_virtual_host,
|
||||
rabbit_user => $rabbit_user,
|
||||
rabbit_password => $rabbit_password,
|
||||
use_syslog => $use_syslog,
|
||||
log_facility => $log_facility,
|
||||
verbose => $verbose,
|
||||
debug => $debug,
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ describe 'openstack::cinder::all' do
|
||||
:rabbit_virtual_host => '/',
|
||||
:package_ensure => 'present',
|
||||
:api_paste_config => '/etc/cinder/api-paste.ini',
|
||||
:use_syslog => false,
|
||||
:log_facility => 'LOG_USER',
|
||||
:verbose => false
|
||||
)
|
||||
should contain_class('cinder::api').with(
|
||||
@@ -111,6 +113,19 @@ describe 'openstack::cinder::all' do
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with custom syslog settings' 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
|
||||
|
||||
context 'with unsupported db type' do
|
||||
|
||||
before do
|
||||
|
||||
@@ -27,6 +27,8 @@ describe 'openstack::cinder::controller' 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
|
||||
)
|
||||
@@ -49,6 +51,22 @@ describe 'openstack::cinder::controller' do
|
||||
)
|
||||
end
|
||||
|
||||
describe 'with custom syslog settings' do
|
||||
before do
|
||||
params.merge!({
|
||||
:use_syslog => true,
|
||||
:log_facility => 'LOG_LOCAL0'
|
||||
})
|
||||
end
|
||||
|
||||
it do
|
||||
should contain_class('cinder').with(
|
||||
:use_syslog => true,
|
||||
:log_facility => 'LOG_LOCAL0'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with unsupported db type' do
|
||||
|
||||
before do
|
||||
|
||||
@@ -190,7 +190,9 @@ describe 'openstack::controller' do
|
||||
:swift_user_password => false,
|
||||
:swift_public_address => false,
|
||||
:swift_internal_address => false,
|
||||
:swift_admin_address => false
|
||||
:swift_admin_address => false,
|
||||
:use_syslog => false,
|
||||
:log_facility => 'LOG_USER'
|
||||
)
|
||||
|
||||
should contain_class('keystone').with(
|
||||
@@ -322,6 +324,15 @@ describe 'openstack::controller' do
|
||||
context 'when enabled' do
|
||||
it 'should contain enabled glance with defaults' do
|
||||
|
||||
should contain_class('openstack::glance').with(
|
||||
:verbose => false,
|
||||
:debug => false,
|
||||
:registry_host => '0.0.0.0',
|
||||
:enabled => true,
|
||||
:use_syslog => false,
|
||||
:log_facility => 'LOG_USER'
|
||||
)
|
||||
|
||||
should contain_class('glance::api').with(
|
||||
:verbose => false,
|
||||
:debug => false,
|
||||
@@ -384,11 +395,22 @@ describe 'openstack::controller' do
|
||||
:glance_backend => 'rbd',
|
||||
:glance_rbd_store_user => 'myuser',
|
||||
:glance_rbd_store_pool => 'mypool',
|
||||
:db_host => '127.0.0.2'
|
||||
:db_host => '127.0.0.2',
|
||||
:use_syslog => true,
|
||||
:log_facility => 'LOG_LOCAL0'
|
||||
)
|
||||
end
|
||||
|
||||
it 'should override params for glance' do
|
||||
should contain_class('openstack::glance').with(
|
||||
:verbose => false,
|
||||
:debug => false,
|
||||
:registry_host => '127.0.0.2',
|
||||
:enabled => true,
|
||||
:use_syslog => true,
|
||||
:log_facility => 'LOG_LOCAL0'
|
||||
)
|
||||
|
||||
should contain_class('glance::api').with(
|
||||
:verbose => false,
|
||||
:debug => false,
|
||||
@@ -449,6 +471,49 @@ describe 'openstack::controller' do
|
||||
context 'with default params' do
|
||||
|
||||
it 'should contain enabled nova services' do
|
||||
should contain_class('openstack::nova::controller').with(
|
||||
:db_host => '127.0.0.1',
|
||||
:sql_idle_timeout => '3600',
|
||||
:network_manager => 'nova.network.manager.FlatDHCPManager',
|
||||
:network_config => {},
|
||||
:floating_range => false,
|
||||
:fixed_range => '10.0.0.0/24',
|
||||
:public_address => '10.0.0.1',
|
||||
:admin_address => false,
|
||||
:internal_address => '127.0.0.1',
|
||||
:auto_assign_floating_ip => false,
|
||||
:create_networks => true,
|
||||
:num_networks => 1,
|
||||
:multi_host => false,
|
||||
:public_interface => 'eth1',
|
||||
:private_interface => 'eth0',
|
||||
:quantum => false,
|
||||
:quantum_user_password => false,
|
||||
:metadata_shared_secret => false,
|
||||
:security_group_api => 'quantum',
|
||||
:nova_admin_tenant_name => 'services',
|
||||
:nova_admin_user => 'nova',
|
||||
:nova_user_password => 'nova_pass',
|
||||
:nova_db_password => 'nova_pass',
|
||||
:nova_db_user => 'nova',
|
||||
:nova_db_dbname => 'nova',
|
||||
:enabled_apis => 'ec2,osapi_compute,metadata',
|
||||
:api_bind_address => '0.0.0.0',
|
||||
:rabbit_user => 'openstack',
|
||||
:rabbit_password => 'rabbit_pw',
|
||||
:rabbit_hosts => false,
|
||||
:rabbit_cluster_nodes => false,
|
||||
:rabbit_virtual_host => '/',
|
||||
:glance_api_servers => '',
|
||||
:vnc_enabled => true,
|
||||
:vncproxy_host => '10.0.0.1',
|
||||
:use_syslog => false,
|
||||
:log_facility => 'LOG_USER',
|
||||
:debug => false,
|
||||
:verbose => false,
|
||||
:enabled => true
|
||||
)
|
||||
|
||||
should_not contain_resources('nova_config').with_purge(true)
|
||||
should contain_class('nova::rabbitmq').with(
|
||||
:userid => 'openstack',
|
||||
@@ -514,10 +579,18 @@ describe 'openstack::controller' do
|
||||
context 'when params are overridden' do
|
||||
let :params do
|
||||
default_params.merge(
|
||||
:sql_idle_timeout => '30'
|
||||
:sql_idle_timeout => '30',
|
||||
:use_syslog => true,
|
||||
:log_facility => 'LOG_LOCAL0'
|
||||
)
|
||||
end
|
||||
it 'should override params for nova' do
|
||||
should contain_class('openstack::nova::controller').with(
|
||||
:sql_idle_timeout => '30',
|
||||
:use_syslog => true,
|
||||
:log_facility => 'LOG_LOCAL0'
|
||||
)
|
||||
|
||||
should contain_class('nova').with(
|
||||
:sql_idle_timeout => '30'
|
||||
)
|
||||
@@ -589,10 +662,12 @@ describe 'openstack::controller' do
|
||||
:cinder_db_user => 'baz',
|
||||
:cinder_db_dbname => 'blah',
|
||||
:sql_idle_timeout => '30',
|
||||
:db_host => '127.0.0.2'
|
||||
:db_host => '127.0.0.2',
|
||||
:use_syslog => true,
|
||||
:log_facility => 'LOG_LOCAL0'
|
||||
)
|
||||
end
|
||||
it 'should configure cinder using defaults' do
|
||||
it 'should configure cinder using custom parameters' do
|
||||
should contain_class('cinder').with(
|
||||
:debug => true,
|
||||
:verbose => true,
|
||||
@@ -660,6 +735,8 @@ describe 'openstack::controller' do
|
||||
:keystone_host => '127.0.0.1',
|
||||
:enabled => true,
|
||||
:enable_server => true,
|
||||
:use_syslog => false,
|
||||
:log_facility => 'LOG_USER',
|
||||
:debug => true,
|
||||
:verbose => true
|
||||
)
|
||||
|
||||
@@ -32,6 +32,8 @@ describe 'openstack::glance' do
|
||||
:keystone_password => 'glance_user_pass',
|
||||
:sql_connection => 'mysql://glance:glance_db_pass@127.0.0.1/glance',
|
||||
:sql_idle_timeout => '3600',
|
||||
:use_syslog => false,
|
||||
:log_facility => 'LOG_USER',
|
||||
:enabled => true
|
||||
)
|
||||
should contain_class('glance::registry').with(
|
||||
@@ -46,6 +48,8 @@ describe 'openstack::glance' do
|
||||
:keystone_password => 'glance_user_pass',
|
||||
:sql_connection => 'mysql://glance:glance_db_pass@127.0.0.1/glance',
|
||||
:sql_idle_timeout => '3600',
|
||||
:use_syslog => false,
|
||||
:log_facility => 'LOG_USER',
|
||||
:enabled => true
|
||||
)
|
||||
should contain_class('glance::backend::file')
|
||||
@@ -135,4 +139,24 @@ describe 'openstack::glance' do
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with custom syslog settings' do
|
||||
before do
|
||||
params.merge!({
|
||||
:use_syslog => true,
|
||||
:log_facility => 'LOG_LOCAL0'
|
||||
})
|
||||
end
|
||||
|
||||
it 'should set parameters in included classes' do
|
||||
should contain_class('glance::api').with(
|
||||
:use_syslog => true,
|
||||
:log_facility => 'LOG_LOCAL0'
|
||||
)
|
||||
|
||||
should contain_class('glance::registry').with(
|
||||
:use_syslog => true,
|
||||
:log_facility => 'LOG_LOCAL0'
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -40,7 +40,9 @@ describe 'openstack::keystone' do
|
||||
:token_format => 'PKI',
|
||||
:enabled => true,
|
||||
:token_driver => 'keystone.token.backends.kvs.Token',
|
||||
:sql_connection => 'mysql://keystone:pass@127.0.0.1/keystone'
|
||||
:sql_connection => 'mysql://keystone:pass@127.0.0.1/keystone',
|
||||
:use_syslog => false,
|
||||
:log_facility => 'LOG_USER'
|
||||
)
|
||||
[ 'glance', 'cinder', 'quantum' ].each do |type|
|
||||
should contain_class("#{type}::keystone::auth").with(
|
||||
@@ -101,4 +103,20 @@ describe 'openstack::keystone' do
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with custom syslog settings' do
|
||||
let :params do
|
||||
required_params.merge(
|
||||
:use_syslog => true,
|
||||
:log_facility => 'LOG_LOCAL0'
|
||||
)
|
||||
end
|
||||
|
||||
it 'should set parameters in included classes' do
|
||||
should contain_class('keystone').with(
|
||||
:use_syslog => true,
|
||||
:log_facility => 'LOG_LOCAL0'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -49,7 +49,9 @@ describe 'openstack::nova::controller' do
|
||||
:verbose => false,
|
||||
:rabbit_hosts => false,
|
||||
:rabbit_host => '127.0.0.1',
|
||||
:memcached_servers => false
|
||||
:memcached_servers => false,
|
||||
:use_syslog => false,
|
||||
:log_facility => 'LOG_USER'
|
||||
)
|
||||
|
||||
should contain_class('nova::api').with(
|
||||
@@ -96,4 +98,20 @@ describe 'openstack::nova::controller' do
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with custom syslog settings' do
|
||||
let :params do
|
||||
default_params.merge(
|
||||
:use_syslog => true,
|
||||
:log_facility => 'LOG_LOCAL0'
|
||||
)
|
||||
end
|
||||
it do
|
||||
should contain_class('nova').with(
|
||||
:use_syslog => true,
|
||||
:log_facility => 'LOG_LOCAL0'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -34,6 +34,8 @@ describe 'openstack::quantum' do
|
||||
:rabbit_virtual_host => '/',
|
||||
:rabbit_user => 'rabbit_user',
|
||||
:rabbit_password => 'rabbit_pass',
|
||||
:use_syslog => false,
|
||||
:log_facility => 'LOG_USER',
|
||||
:verbose => false,
|
||||
:debug => false
|
||||
)
|
||||
@@ -123,6 +125,19 @@ describe 'openstack::quantum' do
|
||||
end
|
||||
end
|
||||
|
||||
context 'with custom syslog settings' do
|
||||
before do
|
||||
params.merge!(
|
||||
:use_syslog => true,
|
||||
:log_facility => 'LOG_LOCAL0'
|
||||
)
|
||||
end
|
||||
it { should contain_class('quantum').with(
|
||||
:use_syslog => true,
|
||||
:log_facility => 'LOG_LOCAL0'
|
||||
) }
|
||||
end
|
||||
|
||||
context 'with invalid db_type' do
|
||||
before do
|
||||
params.merge!(:db_type => 'foo', :db_password => 'bar')
|
||||
|
||||
Reference in New Issue
Block a user