Merge "Adding manage_service parameter to all services"
This commit is contained in:
commit
6e63bc4b1a
40
examples/cinder_volume_with_pacemaker.pp
Normal file
40
examples/cinder_volume_with_pacemaker.pp
Normal file
@ -0,0 +1,40 @@
|
||||
# Example: managing cinder controller services with pacemaker
|
||||
#
|
||||
# By setting enabled to false, these services will not be started at boot. By setting
|
||||
# manage_service to false, puppet will not kill these services on every run. This
|
||||
# allows the Pacemaker resource manager to dynamically determine on which node each
|
||||
# service should run.
|
||||
#
|
||||
# The puppet commands below would ideally be applied to at least three nodes.
|
||||
#
|
||||
# Note that cinder-api is associated with the virtual IP address as
|
||||
# it is called from external services. The remaining services connect to the
|
||||
# database and/or message broker independently.
|
||||
#
|
||||
# Example pacemaker resource configuration commands (configured once per cluster):
|
||||
#
|
||||
# sudo pcs resource create cinder_vip ocf:heartbeat:IPaddr2 params ip=192.0.2.3 \
|
||||
# cidr_netmask=24 op monitor interval=10s
|
||||
#
|
||||
# sudo pcs resource create cinder_api_service lsb:openstack-cinder-api
|
||||
# sudo pcs resource create cinder_scheduler_service lsb:openstack-cinder-scheduler
|
||||
#
|
||||
# sudo pcs constraint colocation add cinder_api_service with cinder_vip
|
||||
|
||||
class { 'cinder':
|
||||
sql_connection => 'mysql://cinder:secret_block_password@openstack-controller.example.com/cinder',
|
||||
}
|
||||
|
||||
class { 'cinder::api':
|
||||
keystone_password => 'CINDER_PW',
|
||||
keystone_user => 'cinder',
|
||||
enabled => false,
|
||||
manage_service => false,
|
||||
}
|
||||
|
||||
class { 'cinder::scheduler':
|
||||
scheduler_driver => 'cinder.scheduler.simple.SimpleScheduler',
|
||||
enabled => false,
|
||||
manage_service => false,
|
||||
}
|
||||
|
@ -60,6 +60,10 @@
|
||||
# (optional) The state of the service
|
||||
# Defaults to true
|
||||
#
|
||||
# [*manage_service*]
|
||||
# (optional) Whether to start/stop the service
|
||||
# Defaults to true
|
||||
#
|
||||
# [*ratelimits*]
|
||||
# (optional) The state of the service
|
||||
# Defaults to undef. If undefined the default ratelimiting values are used.
|
||||
@ -83,6 +87,7 @@ class cinder::api (
|
||||
$package_ensure = 'present',
|
||||
$bind_host = '0.0.0.0',
|
||||
$enabled = true,
|
||||
$manage_service = true,
|
||||
$ratelimits = undef,
|
||||
$ratelimits_factory =
|
||||
'cinder.api.v1.limits:RateLimitingMiddleware.factory'
|
||||
@ -115,9 +120,13 @@ class cinder::api (
|
||||
logoutput => 'on_failure',
|
||||
require => Package['cinder'],
|
||||
}
|
||||
$ensure = 'running'
|
||||
if $manage_service {
|
||||
$ensure = 'running'
|
||||
}
|
||||
} else {
|
||||
$ensure = 'stopped'
|
||||
if $manage_service {
|
||||
$ensure = 'stopped'
|
||||
}
|
||||
}
|
||||
|
||||
service { 'cinder-api':
|
||||
|
@ -2,7 +2,8 @@
|
||||
class cinder::scheduler (
|
||||
$scheduler_driver = false,
|
||||
$package_ensure = 'present',
|
||||
$enabled = true
|
||||
$enabled = true,
|
||||
$manage_service = true
|
||||
) {
|
||||
|
||||
include cinder::params
|
||||
@ -27,10 +28,12 @@ class cinder::scheduler (
|
||||
}
|
||||
}
|
||||
|
||||
if $enabled {
|
||||
$ensure = 'running'
|
||||
} else {
|
||||
$ensure = 'stopped'
|
||||
if $manage_service {
|
||||
if $enabled {
|
||||
$ensure = 'running'
|
||||
} else {
|
||||
$ensure = 'stopped'
|
||||
}
|
||||
}
|
||||
|
||||
service { 'cinder-scheduler':
|
||||
|
@ -1,7 +1,8 @@
|
||||
# $volume_name_template = volume-%s
|
||||
class cinder::volume (
|
||||
$package_ensure = 'present',
|
||||
$enabled = true
|
||||
$enabled = true,
|
||||
$manage_service = true
|
||||
) {
|
||||
|
||||
include cinder::params
|
||||
@ -21,10 +22,12 @@ class cinder::volume (
|
||||
}
|
||||
}
|
||||
|
||||
if $enabled {
|
||||
$ensure = 'running'
|
||||
} else {
|
||||
$ensure = 'stopped'
|
||||
if $manage_service {
|
||||
if $enabled {
|
||||
$ensure = 'running'
|
||||
} else {
|
||||
$ensure = 'stopped'
|
||||
}
|
||||
}
|
||||
|
||||
service { 'cinder-volume':
|
||||
@ -34,5 +37,4 @@ class cinder::volume (
|
||||
hasstatus => true,
|
||||
require => Package['cinder'],
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,7 +15,8 @@ describe 'cinder::api' do
|
||||
end
|
||||
|
||||
it { should contain_service('cinder-api').with(
|
||||
'hasstatus' => true
|
||||
'hasstatus' => true,
|
||||
'ensure' => 'running'
|
||||
)}
|
||||
|
||||
it 'should configure cinder api correctly' do
|
||||
@ -138,11 +139,23 @@ describe 'cinder::api' do
|
||||
let :params do
|
||||
req_params.merge({'enabled' => false})
|
||||
end
|
||||
it 'should stop the service' do
|
||||
should contain_service('cinder-api').with_ensure('stopped')
|
||||
end
|
||||
it 'should contain db_sync exec' do
|
||||
should_not contain_exec('cinder-manage db_sync')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with manage_service false' do
|
||||
let :params do
|
||||
req_params.merge({'manage_service' => false})
|
||||
end
|
||||
it 'should not change the state of the service' do
|
||||
should contain_service('cinder-api').without_ensure
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with ratelimits' do
|
||||
let :params do
|
||||
req_params.merge({ :ratelimits => '(GET, "*", .*, 100, MINUTE);(POST, "*", .*, 200, MINUTE)' })
|
||||
|
@ -38,6 +38,16 @@ describe 'cinder::scheduler' do
|
||||
it { should contain_cinder_config('DEFAULT/scheduler_driver').with_value('cinder.scheduler.filter_scheduler.FilterScheduler') }
|
||||
it { should contain_package('cinder-scheduler').with_ensure('present') }
|
||||
end
|
||||
|
||||
describe 'with manage_service false' do
|
||||
let :params do
|
||||
{ 'manage_service' => false
|
||||
}
|
||||
end
|
||||
it 'should not change the state of the service' do
|
||||
should contain_service('cinder-scheduler').without_ensure
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
@ -15,4 +15,12 @@ describe 'cinder::volume' do
|
||||
'hasstatus' => true
|
||||
)}
|
||||
|
||||
describe 'with manage_service false' do
|
||||
let :params do
|
||||
{ 'manage_service' => false }
|
||||
end
|
||||
it 'should not change the state of the service' do
|
||||
should contain_service('cinder-volume').without_ensure
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user