Skip to content

Commit

Permalink
Deprecate logdir parameter (use log_dir instead)
Browse files Browse the repository at this point in the history
The logdir parameter is deprecated since grizzly, we now use log_dir
instead. (the retro-compatibility is kept)
Cosmetics: align all parameters of nova class.

Closes-bug: #1282295
(cherry picked from commit 34a961c)
Change-Id: I20b3dee628205d53779afc4db7506a0701ad1bd4
  • Loading branch information
sbadia committed Feb 24, 2014
1 parent 5b34679 commit fdcdde0
Show file tree
Hide file tree
Showing 2 changed files with 203 additions and 77 deletions.
270 changes: 198 additions & 72 deletions manifests/init.pp
Expand Up @@ -3,84 +3,202 @@
#
# ==Parameters
#
# [database_connection] Connection url to connect to nova database.
# [database_idle_timeout] Timeout before idle db connections are reaped.
# [image_service] Service used to search for and retrieve images. Optional.
# [*ensure_package*]
# (optional) The state of nova packages
# Defaults to 'present'
#
# [*nova_cluster_id*]
# (optional) Tis is how to query all resources from our clutser.
# Defaults to 'localcluster'
#
# [*sql_connection*]
# (optional) Deprecated. Use database_connection instead.
# Defaults to false
#
# [*sql_idle_timeout*]
# (optional) Deprecated. Use database_idle_timeout instead
# Defaults to false
#
# [*database_connection*]
# (optional) Connection url to connect to nova database.
# Defaults to false
#
# [*database_idle_timeout*]
# (optional) Timeout before idle db connections are reaped.
# Defaults to 3600
#
# [*rpc_backend*]
# (optional) The rpc backend implementation to use, can be:
# nova.openstack.common.rpc.impl_kombu (for rabbitmq)
# nova.openstack.common.rpc.impl_qpid (for qpid)
# Defaults to 'nova.openstack.common.rpc.impl_kombu'
#
# [*image_service*]
# (optional) Service used to search for and retrieve images.
# Defaults to 'nova.image.local.LocalImageService'
# [glance_api_servers] List of addresses for api servers. Optional.
# Defaults to localhost:9292.
# [memcached_servers] Use memcached instead of in-process cache. Supply a list of memcached server IP's:Memcached Port. Optional. Defaults to false.
# [rabbit_host] Location of rabbitmq installation. Optional. Defaults to localhost.
# [rabbit_port] Port for rabbitmq instance. Optional. Defaults to 5672.
# [rabbit_hosts] Location of rabbitmq installation. Optional. Defaults to undef.
# [rabbit_password] Password used to connect to rabbitmq. Optional. Defaults to guest.
# [rabbit_userid] User used to connect to rabbitmq. Optional. Defaults to guest.
# [rabbit_virtual_host] The RabbitMQ virtual host. Optional. Defaults to /.
#
# [*glance_api_servers*]
# (optional) List of addresses for api servers.
# Defaults to 'localhost:9292'
#
# [*memcached_servers*]
# (optional) Use memcached instead of in-process cache. Supply a list of memcached server IP's:Memcached Port.
# Defaults to false
#
# [*rabbit_host*]
# (optional) Location of rabbitmq installation.
# Defaults to 'localhost'
#
# [*rabbit_hosts*]
# (optional) List of clustered rabbit servers.
# Defaults to false
#
# [*rabbit_port*]
# (optional) Port for rabbitmq instance.
# Defaults to '5672'
#
# [*rabbit_password*]
# (optional) Password used to connect to rabbitmq.
# Defaults to 'guest'
#
# [*rabbit_userid*]
# (optional) User used to connect to rabbitmq.
# Defaults to 'guest'
#
# [*rabbit_virtual_host*]
# (optional) The RabbitMQ virtual host.
# Defaults to '/'
#
# [*qpid_hostname*]
# (optional) Location of qpid server
# Defaults to 'localhost'
#
# [*qpid_port*]
# (optional) Port for qpid server
# Defaults to '5672'
#
# [*qpid_username*]
# (optional) Username to use when connecting to qpid
# Defaults to 'guest'
#
# [*qpid_password*]
# (optional) Password to use when connecting to qpid
# Defaults to 'guest'
#
# [*qpid_heartbeat*]
# (optional) Seconds between connection keepalive heartbeats
# Defaults to 60
#
# [*qpid_protocol*]
# (optional) Transport to use, either 'tcp' or 'ssl''
# Defaults to 'tcp'
#
# [*qpid_sasl_mechanisms*]
# (optional) Enable one or more SASL mechanisms
# Defaults to false
#
# [*qpid_tcp_nodelay*]
# (optional) Disable Nagle algorithm
# Defaults to true
#
# [auth_strategy]
# [service_down_time] maximum time since last check-in for up service. Optional.
# Defaults to 60
# [logdir] Directory where logs should be stored. Optional. Defaults to '/var/log/nova'.
# [state_path] Directory for storing state. Optional. Defaults to '/var/lib/nova'.
# [lock_path] Directory for lock files. Optional. Distro specific default.
# [verbose] Rather to print more verbose output. Optional. Defaults to false.
# [periodic_interval] Seconds between running periodic tasks. Optional.
# Defaults to '60'.
# [report_interval] Interval at which nodes report to data store. Optional.
# Defaults to '10'.
# [root_helper] Command used for roothelper. Optional. Distro specific.
# [monitoring_notifications] A boolean specifying whether or not to send system usage data notifications out on the message queue. Optional, false by default. Only valid for stable/essex.
# [use_syslog] Use syslog for logging. Optional. Defaults to false.
# [log_facility] Syslog facility to receive log lines. Optional. Defaults to LOG_USER.
# Defaults to 'keystone'
#
# [*service_down_time*]
# (optional) Maximum time since last check-in for up service.
# Defaults to 60
#
# [*logdir*]
# (optional) Deprecated. Use log_dir instead.
# Defaults to false
#
# [*log_dir*]
# (optional) Directory where logs should be stored.
# Defaults to '/var/log/nova'
#
# [*state_path*]
# (optional) Directory for storing state.
# Defaults to '/var/lib/nova'
#
# [*lock_path*]
# (optional) Directory for lock files.
# On RHEL will be '/var/lib/nova/tmp' and on Debian '/var/lock/nova'
# Defaults to $::nova::params::lock_path
#
# [*verbose*]
# (optional) Set log output to verbose output.
# Defaults to false
#
# [*periodic_interval*]
# (optional) Seconds between running periodic tasks.
# Defaults to '60'
#
# [*report_interval*]
# (optional) Interval at which nodes report to data store.
# Defaults to '10'
#
# [*monitoring_notifications*]
# (optional) Whether or not to send system usage data notifications out on the message queue. Only valid for stable/essex.
# Defaults to false
#
# [*use_syslog*]
# (optional) Use syslog for logging
# Defaults to false
#
# [*log_facility*]
# (optional) Syslog facility to receive log lines.
# Defaults to 'LOG_USER'
#
class nova(
$ensure_package = 'present',
$ensure_package = 'present',
# this is how to query all resources from our clutser
$nova_cluster_id='localcluster',
# note: sql_* deprecated for database_*
$sql_connection = false,
$sql_idle_timeout = false,
$database_connection = false,
$database_idle_timeout = 3600,
$rpc_backend = 'nova.openstack.common.rpc.impl_kombu',
$image_service = 'nova.image.glance.GlanceImageService',
$nova_cluster_id = 'localcluster',
$database_connection = false,
$database_idle_timeout = 3600,
$rpc_backend = 'nova.openstack.common.rpc.impl_kombu',
$image_service = 'nova.image.glance.GlanceImageService',
# these glance params should be optional
# this should probably just be configured as a glance client
$glance_api_servers = 'localhost:9292',
$memcached_servers = false,
$rabbit_host = 'localhost',
$rabbit_hosts = false,
$rabbit_password='guest',
$rabbit_port='5672',
$rabbit_userid='guest',
$rabbit_virtual_host='/',
$qpid_hostname = 'localhost',
$qpid_port = '5672',
$qpid_username = 'guest',
$qpid_password = 'guest',
$qpid_reconnect = true,
$qpid_reconnect_timeout = 0,
$qpid_reconnect_limit = 0,
$glance_api_servers = 'localhost:9292',
$memcached_servers = false,
$rabbit_host = 'localhost',
$rabbit_hosts = false,
$rabbit_password = 'guest',
$rabbit_port = '5672',
$rabbit_userid = 'guest',
$rabbit_virtual_host = '/',
$qpid_hostname = 'localhost',
$qpid_port = '5672',
$qpid_username = 'guest',
$qpid_password = 'guest',
$qpid_reconnect = true,
$qpid_reconnect_timeout = 0,
$qpid_reconnect_limit = 0,
$qpid_reconnect_interval_min = 0,
$qpid_reconnect_interval_max = 0,
$qpid_reconnect_interval = 0,
$qpid_heartbeat = 60,
$qpid_protocol = 'tcp',
$qpid_tcp_nodelay = true,
$auth_strategy = 'keystone',
$service_down_time = 60,
$logdir = '/var/log/nova',
$state_path = '/var/lib/nova',
$lock_path = $::nova::params::lock_path,
$verbose = false,
$debug = false,
$periodic_interval = '60',
$report_interval = '10',
$rootwrap_config = '/etc/nova/rootwrap.conf',
$qpid_reconnect_interval = 0,
$qpid_heartbeat = 60,
$qpid_protocol = 'tcp',
$qpid_tcp_nodelay = true,
$auth_strategy = 'keystone',
$service_down_time = 60,
$log_dir = '/var/log/nova',
$state_path = '/var/lib/nova',
$lock_path = $::nova::params::lock_path,
$verbose = false,
$debug = false,
$periodic_interval = '60',
$report_interval = '10',
$rootwrap_config = '/etc/nova/rootwrap.conf',
$monitoring_notifications = false,
$use_syslog = false,
$log_facility = 'LOG_USER',
# DEPRECATED PARAMETERS
# deprecated in folsom
#$root_helper = $::nova::params::root_helper,
$monitoring_notifications = false,
$use_syslog = false,
$log_facility = 'LOG_USER',
$sql_connection = false,
$sql_idle_timeout = false,
$logdir = false,
) inherits nova::params {

# all nova_config resources should be applied
Expand Down Expand Up @@ -135,10 +253,6 @@
require => Package['nova-common'],
}

file { $logdir:
ensure => directory,
mode => '0750',
}
file { '/etc/nova/nova.conf':
mode => '0640',
}
Expand Down Expand Up @@ -235,10 +349,22 @@
}
}

if $logdir {
warning('The logdir parameter is deprecated, use log_dir instead.')
$log_dir_real = $logdir
} else {
$log_dir_real = $log_dir
}

file { $log_dir_real:
ensure => directory,
mode => '0750',
}

nova_config {
'DEFAULT/verbose': value => $verbose;
'DEFAULT/debug': value => $debug;
'DEFAULT/logdir': value => $logdir;
'DEFAULT/log_dir': value => $log_dir_real;
'DEFAULT/rpc_backend': value => $rpc_backend;
# Following may need to be broken out to different nova services
'DEFAULT/state_path': value => $state_path;
Expand Down
10 changes: 5 additions & 5 deletions spec/classes/nova_init_spec.rb
Expand Up @@ -72,7 +72,7 @@

it { should contain_nova_config('DEFAULT/verbose').with_value(false) }
it { should contain_nova_config('DEFAULT/debug').with_value(false) }
it { should contain_nova_config('DEFAULT/logdir').with_value('/var/log/nova') }
it { should contain_nova_config('DEFAULT/log_dir').with_value('/var/log/nova') }
it { should contain_nova_config('DEFAULT/state_path').with_value('/var/lib/nova') }
it { should contain_nova_config('DEFAULT/lock_path').with_value('/var/lock/nova') }
it { should contain_nova_config('DEFAULT/service_down_time').with_value('60') }
Expand All @@ -88,7 +88,7 @@
'database_idle_timeout' => '30',
'verbose' => true,
'debug' => true,
'logdir' => '/var/log/nova2',
'log_dir' => '/var/log/nova2',
'image_service' => 'nova.image.local.LocalImageService',
'rabbit_host' => 'rabbit',
'rabbit_userid' => 'rabbit_user',
Expand Down Expand Up @@ -122,7 +122,7 @@

it { should contain_nova_config('DEFAULT/verbose').with_value(true) }
it { should contain_nova_config('DEFAULT/debug').with_value(true) }
it { should contain_nova_config('DEFAULT/logdir').with_value('/var/log/nova2') }
it { should contain_nova_config('DEFAULT/log_dir').with_value('/var/log/nova2') }
it { should contain_nova_config('DEFAULT/state_path').with_value('/var/lib/nova2') }
it { should contain_nova_config('DEFAULT/lock_path').with_value('/var/locky/path') }
it { should contain_nova_config('DEFAULT/service_down_time').with_value('120') }
Expand Down Expand Up @@ -194,7 +194,7 @@
'database_idle_timeout' => '30',
'verbose' => true,
'debug' => true,
'logdir' => '/var/log/nova2',
'log_dir' => '/var/log/nova2',
'image_service' => 'nova.image.local.LocalImageService',
'rpc_backend' => 'nova.openstack.common.rpc.impl_qpid',
'lock_path' => '/var/locky/path',
Expand Down Expand Up @@ -232,7 +232,7 @@

it { should contain_nova_config('DEFAULT/verbose').with_value(true) }
it { should contain_nova_config('DEFAULT/debug').with_value(true) }
it { should contain_nova_config('DEFAULT/logdir').with_value('/var/log/nova2') }
it { should contain_nova_config('DEFAULT/log_dir').with_value('/var/log/nova2') }
it { should contain_nova_config('DEFAULT/state_path').with_value('/var/lib/nova2') }
it { should contain_nova_config('DEFAULT/lock_path').with_value('/var/locky/path') }
it { should contain_nova_config('DEFAULT/service_down_time').with_value('120') }
Expand Down

0 comments on commit fdcdde0

Please sign in to comment.