Move state_path and lock_path to base neutron class
Add state_path and lock_path parameters to the base neutron class, and deprecate those same parameters from neutron::server. This is because all Neutron services need those configured in neutron.conf, not only neutron-server. I am not sure if it makes sense to override the neutron_config values from the neutron base class in the way I did (in order to preserve the current behavior.) It may be better to just depreciate those parameters outright, instead. Change-Id: I19819051e4d7bf8ed9caf81adc07a817646e3d21 Closes-bug: 1404017
This commit is contained in:
parent
f616df23c6
commit
7b6b4515bf
@ -194,6 +194,16 @@
|
||||
# If set to boolean false, it will not log to any directory
|
||||
# Defaults to /var/log/neutron
|
||||
#
|
||||
# [*state_path*]
|
||||
# (optional) Where to store state files. This directory must be writable
|
||||
# by the user executing the agent
|
||||
# Defaults to: /var/lib/neutron
|
||||
#
|
||||
# [*lock_path*]
|
||||
# (optional) Where to store lock files. This directory must be writeable
|
||||
# by the user executing the agent
|
||||
# Defaults to: /var/lib/neutron/lock
|
||||
#
|
||||
class neutron (
|
||||
$enabled = true,
|
||||
$package_ensure = 'present',
|
||||
@ -252,6 +262,8 @@ class neutron (
|
||||
$log_facility = 'LOG_USER',
|
||||
$log_file = false,
|
||||
$log_dir = '/var/log/neutron',
|
||||
$state_path = '/var/lib/neutron',
|
||||
$lock_path = '/var/lib/neutron/lock',
|
||||
) {
|
||||
|
||||
include neutron::params
|
||||
@ -323,6 +335,8 @@ class neutron (
|
||||
'DEFAULT/control_exchange': value => $control_exchange;
|
||||
'DEFAULT/rpc_backend': value => $rpc_backend;
|
||||
'DEFAULT/api_extensions_path': value => $api_extensions_path;
|
||||
'DEFAULT/state_path': value => $state_path;
|
||||
'DEFAULT/lock_path': value => $lock_path;
|
||||
'agent/root_helper': value => $root_helper;
|
||||
'agent/report_interval': value => $report_interval;
|
||||
}
|
||||
|
@ -149,14 +149,10 @@
|
||||
# Defaults to: 75
|
||||
#
|
||||
# [*state_path*]
|
||||
# (optional) Where to store dnsmasq state files. This directory must be
|
||||
# writable by the user executing the agent
|
||||
# Defaults to: /var/lib/neutron
|
||||
# (optional) Deprecated. Use state_path parameter on base neutron class instead.
|
||||
#
|
||||
# [*lock_path*]
|
||||
# (optional) Where to store dnsmasq lock files. This directory must be
|
||||
# writable by the user executing the agent
|
||||
# Defaults to: /var/lib/neutron/lock
|
||||
# (optional) Deprecated. Use lock_path parameter on base neutron class instead.
|
||||
#
|
||||
# [*router_scheduler_driver*]
|
||||
# (optional) Driver to use for scheduling router to a default L3 agent. Could be:
|
||||
@ -214,8 +210,6 @@ class neutron::server (
|
||||
$api_workers = $::processorcount,
|
||||
$rpc_workers = $::processorcount,
|
||||
$agent_down_time = '75',
|
||||
$state_path = '/var/lib/neutron',
|
||||
$lock_path = '/var/lib/neutron/lock',
|
||||
$router_scheduler_driver = 'neutron.scheduler.l3_agent_scheduler.ChanceScheduler',
|
||||
$router_distributed = false,
|
||||
$l3_ha = false,
|
||||
@ -227,6 +221,8 @@ class neutron::server (
|
||||
$log_dir = undef,
|
||||
$log_file = undef,
|
||||
$report_interval = undef,
|
||||
$state_path = undef,
|
||||
$lock_path = undef,
|
||||
) {
|
||||
|
||||
include neutron::params
|
||||
@ -295,8 +291,6 @@ class neutron::server (
|
||||
'DEFAULT/rpc_workers': value => $rpc_workers;
|
||||
'DEFAULT/agent_down_time': value => $agent_down_time;
|
||||
'DEFAULT/router_scheduler_driver': value => $router_scheduler_driver;
|
||||
'DEFAULT/state_path': value => $state_path;
|
||||
'DEFAULT/lock_path': value => $lock_path;
|
||||
'DEFAULT/router_distributed': value => $router_distributed;
|
||||
'database/connection': value => $database_connection, secret => true;
|
||||
'database/idle_timeout': value => $database_idle_timeout;
|
||||
@ -307,6 +301,28 @@ class neutron::server (
|
||||
'database/max_overflow': value => $database_max_overflow;
|
||||
}
|
||||
|
||||
if $state_path {
|
||||
# If we got state_path here, display deprecation warning and override the value from
|
||||
# the base class. This preserves the behavior of before state_path was deprecated.
|
||||
|
||||
warning('The state_path parameter is deprecated. Use the state_path parameter on the base neutron class instead.')
|
||||
|
||||
Neutron_config <| title == 'DEFAULT/state_path' |> {
|
||||
value => $state_path,
|
||||
}
|
||||
}
|
||||
|
||||
if $lock_path {
|
||||
# If we got lock_path here, display deprecation warning and override the value from
|
||||
# the base class. This preserves the behavior of before lock_path was deprecated.
|
||||
|
||||
warning('The lock_path parameter is deprecated. Use the lock_path parameter on the base neutron class instead.')
|
||||
|
||||
Neutron_config <| title == 'DEFAULT/lock_path' |> {
|
||||
value => $lock_path,
|
||||
}
|
||||
}
|
||||
|
||||
if ($::neutron::params::server_package) {
|
||||
Package['neutron-server'] -> Neutron_api_config<||>
|
||||
Package['neutron-server'] -> Neutron_config<||>
|
||||
|
@ -123,6 +123,8 @@ describe 'neutron' do
|
||||
should contain_neutron_config('DEFAULT/allow_overlapping_ips').with_value(false)
|
||||
should contain_neutron_config('DEFAULT/api_extensions_path').with_value(nil)
|
||||
should contain_neutron_config('DEFAULT/control_exchange').with_value('neutron')
|
||||
should contain_neutron_config('DEFAULT/state_path').with_value('/var/lib/neutron')
|
||||
should contain_neutron_config('DEFAULT/lock_path').with_value('/var/lib/neutron/lock')
|
||||
should contain_neutron_config('agent/root_helper').with_value('sudo neutron-rootwrap /etc/neutron/rootwrap.conf')
|
||||
should contain_neutron_config('agent/report_interval').with_value('30')
|
||||
end
|
||||
@ -370,6 +372,17 @@ describe 'neutron' do
|
||||
}
|
||||
end
|
||||
|
||||
shared_examples_for 'with state and lock paths set' do
|
||||
before { params.merge!(
|
||||
:state_path => 'state_path',
|
||||
:lock_path => 'lock_path'
|
||||
)}
|
||||
it {
|
||||
should contain_neutron_config('DEFAULT/state_path').with_value('state_path')
|
||||
should contain_neutron_config('DEFAULT/lock_path').with_value('lock_path')
|
||||
}
|
||||
end
|
||||
|
||||
shared_examples_for 'without service_plugins' do
|
||||
it { should_not contain_neutron_config('DEFAULT/service_plugins') }
|
||||
end
|
||||
|
@ -28,8 +28,6 @@ describe 'neutron::server' do
|
||||
:database_max_overflow => '20',
|
||||
:sync_db => false,
|
||||
:agent_down_time => '75',
|
||||
:state_path => '/var/lib/neutron',
|
||||
:lock_path => '/var/lib/neutron/lock',
|
||||
:router_scheduler_driver => 'neutron.scheduler.l3_agent_scheduler.ChanceScheduler',
|
||||
:router_distributed => false,
|
||||
:l3_ha => false,
|
||||
@ -99,8 +97,6 @@ describe 'neutron::server' do
|
||||
should contain_neutron_config('DEFAULT/rpc_workers').with_value(facts[:processorcount])
|
||||
should contain_neutron_config('DEFAULT/agent_down_time').with_value(p[:agent_down_time])
|
||||
should contain_neutron_config('DEFAULT/router_scheduler_driver').with_value(p[:router_scheduler_driver])
|
||||
should contain_neutron_config('DEFAULT/state_path').with_value(p[:state_path])
|
||||
should contain_neutron_config('DEFAULT/lock_path').with_value(p[:lock_path])
|
||||
end
|
||||
|
||||
context 'with manage_service as false' do
|
||||
@ -162,6 +158,17 @@ describe 'neutron::server' do
|
||||
should contain_service('neutron-server').with_name('custom-service-name')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with state_path and lock_path parameters' do
|
||||
before :each do
|
||||
params.merge!(:state_path => 'state_path',
|
||||
:lock_path => 'lock_path' )
|
||||
end
|
||||
it 'should override state_path and lock_path from base class' do
|
||||
should contain_neutron_config('DEFAULT/state_path').with_value(p[:state_path])
|
||||
should contain_neutron_config('DEFAULT/lock_path').with_value(p[:lock_path])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'a neutron server with auth_admin_prefix set' do
|
||||
|
Loading…
x
Reference in New Issue
Block a user