Add support for configuring qpid.
Support for qpid which uses dprince/qpid (posted on puppetforge). Currently requires dprince/qpid 1.0.0 or greater. Change-Id: I504e4aac985b50f9a64a19ec5445e5c2c39de720
This commit is contained in:
parent
cb3b84abb0
commit
cc7b3250f9
@ -6,6 +6,7 @@ fixtures:
|
||||
"stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git"
|
||||
"sysctl": "git://github.com/duritong/puppet-sysctl.git"
|
||||
"rabbitmq": "git://github.com/puppetlabs/puppetlabs-rabbitmq.git"
|
||||
'inifile': 'git://github.com/cprice-puppet/puppetlabs-inifile'
|
||||
"inifile": "git://github.com/cprice-puppet/puppetlabs-inifile"
|
||||
"qpid": "git://github.com/dprince/puppet-qpid.git"
|
||||
symlinks:
|
||||
"cinder": "#{source_dir}"
|
||||
|
@ -11,3 +11,4 @@ dependency 'cprice404/inifile', '>= 0.9.0'
|
||||
dependency 'puppetlabs/mysql', '>= 0.5.0'
|
||||
dependency 'puppetlabs/stdlib', '>= 2.4.0'
|
||||
dependency 'puppetlabs/rabbitmq', '>= 2.0.2'
|
||||
dependency 'dprince/qpid', '>= 1.0.0'
|
||||
|
@ -5,15 +5,29 @@
|
||||
# $root_helper = sudo /usr/local/bin/cinder-rootwrap /etc/cinder/rootwrap.conf
|
||||
class cinder (
|
||||
$sql_connection,
|
||||
$rabbit_host = '127.0.0.1',
|
||||
$rabbit_port = 5672,
|
||||
$rabbit_hosts = undef,
|
||||
$rabbit_virtual_host = '/',
|
||||
$rabbit_userid = 'guest',
|
||||
$rabbit_password = false,
|
||||
$package_ensure = 'present',
|
||||
$api_paste_config = '/etc/cinder/api-paste.ini',
|
||||
$verbose = 'False'
|
||||
$rpc_backend = 'cinder.openstack.common.rpc.impl_kombu',
|
||||
$rabbit_host = '127.0.0.1',
|
||||
$rabbit_port = 5672,
|
||||
$rabbit_hosts = undef,
|
||||
$rabbit_virtual_host = '/',
|
||||
$rabbit_userid = 'guest',
|
||||
$rabbit_password = false,
|
||||
$qpid_hostname = 'localhost',
|
||||
$qpid_port = '5672',
|
||||
$qpid_username = 'guest',
|
||||
$qpid_password = false,
|
||||
$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,
|
||||
$package_ensure = 'present',
|
||||
$api_paste_config = '/etc/cinder/api-paste.ini',
|
||||
$verbose = 'False'
|
||||
) {
|
||||
|
||||
include cinder::params
|
||||
@ -47,35 +61,61 @@ class cinder (
|
||||
require => Package[$::cinder::params::package_name],
|
||||
}
|
||||
|
||||
if $rabbit_hosts {
|
||||
cinder_config {
|
||||
'DEFAULT/rabbit_hosts': value => join($rabbit_hosts, ',');
|
||||
if $rpc_backend == 'cinder.openstack.common.rpc.impl_kombu' {
|
||||
|
||||
if ! $rabbit_password {
|
||||
fail('Please specify a rabbit_password parameter.')
|
||||
}
|
||||
} else {
|
||||
|
||||
cinder_config {
|
||||
'DEFAULT/rabbit_host': value => $rabbit_host;
|
||||
'DEFAULT/rabbit_port': value => $rabbit_port;
|
||||
'DEFAULT/rabbit_hosts': value => "$rabbit_host:$rabbit_port";
|
||||
'DEFAULT/rabbit_password': value => $rabbit_password;
|
||||
'DEFAULT/rabbit_userid': value => $rabbit_userid;
|
||||
'DEFAULT/rabbit_virtual_host': value => $rabbit_virtual_host;
|
||||
}
|
||||
|
||||
if size($rabbit_hosts) > 1 {
|
||||
cinder_config { 'DEFAULT/rabbit_ha_queues': value => 'true' }
|
||||
} else {
|
||||
cinder_config { 'DEFAULT/rabbit_ha_queues': value => 'false' }
|
||||
}
|
||||
|
||||
if $rabbit_hosts {
|
||||
cinder_config { 'DEFAULT/rabbit_hosts': value => join($rabbit_hosts, ',') }
|
||||
} elsif $rabbit_host {
|
||||
cinder_config { 'DEFAULT/rabbit_host': value => $rabbit_host }
|
||||
cinder_config { 'DEFAULT/rabbit_port': value => $rabbit_port }
|
||||
cinder_config { 'DEFAULT/rabbit_hosts': value => "${rabbit_host}:${rabbit_port}" }
|
||||
}
|
||||
}
|
||||
|
||||
if ! $rabbit_password {
|
||||
fail('Please specify a rabbit_password parameter.')
|
||||
if $rpc_backend == 'cinder.openstack.common.rpc.impl_qpid' {
|
||||
|
||||
if ! $qpid_password {
|
||||
fail('Please specify a qpid_password parameter.')
|
||||
}
|
||||
|
||||
cinder_config {
|
||||
'DEFAULT/qpid_hostname': value => $qpid_hostname;
|
||||
'DEFAULT/qpid_port': value => $qpid_port;
|
||||
'DEFAULT/qpid_username': value => $qpid_username;
|
||||
'DEFAULT/qpid_password': value => $qpid_password;
|
||||
'DEFAULT/qpid_reconnect': value => $qpid_reconnect;
|
||||
'DEFAULT/qpid_reconnect_timeout': value => $qpid_reconnect_timeout;
|
||||
'DEFAULT/qpid_reconnect_limit': value => $qpid_reconnect_limit;
|
||||
'DEFAULT/qpid_reconnect_interval_min': value => $qpid_reconnect_interval_min;
|
||||
'DEFAULT/qpid_reconnect_interval_max': value => $qpid_reconnect_interval_max;
|
||||
'DEFAULT/qpid_reconnect_interval': value => $qpid_reconnect_interval;
|
||||
'DEFAULT/qpid_heartbeat': value => $qpid_heartbeat;
|
||||
'DEFAULT/qpid_protocol': value => $qpid_protocol;
|
||||
'DEFAULT/qpid_tcp_nodelay': value => $qpid_tcp_nodelay;
|
||||
}
|
||||
}
|
||||
|
||||
cinder_config {
|
||||
'DEFAULT/rabbit_password': value => $rabbit_password;
|
||||
'DEFAULT/rabbit_virtual_host': value => $rabbit_virtual_host;
|
||||
'DEFAULT/rabbit_userid': value => $rabbit_userid;
|
||||
'DEFAULT/sql_connection': value => $sql_connection;
|
||||
'DEFAULT/verbose': value => $verbose;
|
||||
'DEFAULT/api_paste_config': value => $api_paste_config;
|
||||
}
|
||||
|
||||
if size($rabbit_hosts) > 1 {
|
||||
cinder_config { 'DEFAULT/rabbit_ha_queues': value => 'true' }
|
||||
} else {
|
||||
cinder_config { 'DEFAULT/rabbit_ha_queues': value => 'false' }
|
||||
'DEFAULT/rpc_backend': value => $rpc_backend;
|
||||
}
|
||||
|
||||
}
|
||||
|
35
manifests/qpid.pp
Normal file
35
manifests/qpid.pp
Normal file
@ -0,0 +1,35 @@
|
||||
#
|
||||
# class for installing qpid server for cinder
|
||||
#
|
||||
#
|
||||
class cinder::qpid(
|
||||
$enabled = true,
|
||||
$user='guest',
|
||||
$password='guest',
|
||||
$file='/var/lib/qpidd/qpidd.sasldb',
|
||||
$realm='OPENSTACK'
|
||||
) {
|
||||
|
||||
# only configure cinder after the queue is up
|
||||
Class['qpid::server'] -> Package<| title == 'cinder' |>
|
||||
|
||||
if ($enabled) {
|
||||
$service_ensure = 'running'
|
||||
|
||||
qpid_user { $user:
|
||||
password => $password,
|
||||
file => $file,
|
||||
realm => $realm,
|
||||
provider => 'saslpasswd2',
|
||||
require => Class['qpid::server'],
|
||||
}
|
||||
|
||||
} else {
|
||||
$service_ensure = 'stopped'
|
||||
}
|
||||
|
||||
class { 'qpid::server':
|
||||
service_ensure => $service_ensure
|
||||
}
|
||||
|
||||
}
|
51
spec/classes/cinder_qpid_spec.rb
Normal file
51
spec/classes/cinder_qpid_spec.rb
Normal file
@ -0,0 +1,51 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cinder::qpid' do
|
||||
|
||||
let :facts do
|
||||
{:puppetversion => '2.7',
|
||||
:osfamily => 'RedHat'}
|
||||
end
|
||||
|
||||
describe 'with defaults' do
|
||||
|
||||
it 'should contain all of the default resources' do
|
||||
|
||||
should contain_class('qpid::server').with(
|
||||
:service_ensure => 'running',
|
||||
:port => '5672'
|
||||
)
|
||||
|
||||
end
|
||||
|
||||
it 'should contain user' do
|
||||
|
||||
should contain_qpid_user('guest').with(
|
||||
:password => 'guest',
|
||||
:file => '/var/lib/qpidd/qpidd.sasldb',
|
||||
:realm => 'OPENSTACK',
|
||||
:provider => 'saslpasswd2'
|
||||
)
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe 'when disabled' do
|
||||
let :params do
|
||||
{
|
||||
:enabled => false
|
||||
}
|
||||
end
|
||||
|
||||
it 'should be disabled' do
|
||||
|
||||
should_not contain_qpid_user('guest')
|
||||
should contain_class('qpid::server').with(
|
||||
:service_ensure => 'stopped'
|
||||
)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@ -1,7 +1,7 @@
|
||||
require 'spec_helper'
|
||||
describe 'cinder' do
|
||||
let :req_params do
|
||||
{:rabbit_password => 'rpw', :sql_connection => 'mysql://user:password@host/database'}
|
||||
{:rabbit_password => 'guest', :sql_connection => 'mysql://user:password@host/database'}
|
||||
end
|
||||
|
||||
let :facts do
|
||||
@ -16,8 +16,11 @@ describe 'cinder' do
|
||||
it { should contain_class('cinder::params') }
|
||||
|
||||
it 'should contain default config' do
|
||||
should contain_cinder_config('DEFAULT/rpc_backend').with(
|
||||
:value => 'cinder.openstack.common.rpc.impl_kombu'
|
||||
)
|
||||
should contain_cinder_config('DEFAULT/rabbit_password').with(
|
||||
:value => 'rpw'
|
||||
:value => 'guest'
|
||||
)
|
||||
should contain_cinder_config('DEFAULT/rabbit_host').with(
|
||||
:value => '127.0.0.1'
|
||||
@ -79,4 +82,33 @@ describe 'cinder' do
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with qpid rpc supplied' do
|
||||
|
||||
let :params do
|
||||
{
|
||||
:sql_connection => 'mysql://user:password@host/database',
|
||||
:qpid_password => 'guest',
|
||||
:rpc_backend => 'cinder.openstack.common.rpc.impl_qpid'
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_cinder_config('DEFAULT/sql_connection').with_value('mysql://user:password@host/database') }
|
||||
it { should contain_cinder_config('DEFAULT/rpc_backend').with_value('cinder.openstack.common.rpc.impl_qpid') }
|
||||
it { should contain_cinder_config('DEFAULT/qpid_hostname').with_value('localhost') }
|
||||
it { should contain_cinder_config('DEFAULT/qpid_port').with_value('5672') }
|
||||
it { should contain_cinder_config('DEFAULT/qpid_username').with_value('guest') }
|
||||
it { should contain_cinder_config('DEFAULT/qpid_password').with_value('guest') }
|
||||
it { should contain_cinder_config('DEFAULT/qpid_reconnect').with_value('true') }
|
||||
it { should contain_cinder_config('DEFAULT/qpid_reconnect_timeout').with_value('0') }
|
||||
it { should contain_cinder_config('DEFAULT/qpid_reconnect_limit').with_value('0') }
|
||||
it { should contain_cinder_config('DEFAULT/qpid_reconnect_interval_min').with_value('0') }
|
||||
it { should contain_cinder_config('DEFAULT/qpid_reconnect_interval_max').with_value('0') }
|
||||
it { should contain_cinder_config('DEFAULT/qpid_reconnect_interval').with_value('0') }
|
||||
it { should contain_cinder_config('DEFAULT/qpid_heartbeat').with_value('60') }
|
||||
it { should contain_cinder_config('DEFAULT/qpid_protocol').with_value('tcp') }
|
||||
it { should contain_cinder_config('DEFAULT/qpid_tcp_nodelay').with_value('true') }
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user