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: Iaad3ce107314865ba2f1e620ed7e7e445c73a2db
This commit is contained in:
@@ -7,6 +7,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"
|
||||
"qpid": "git://github.com/dprince/puppet-qpid.git"
|
||||
'inifile': 'git://github.com/cprice-puppet/puppetlabs-inifile'
|
||||
symlinks:
|
||||
"nova": "#{source_dir}"
|
||||
|
||||
@@ -18,3 +18,4 @@ dependency 'puppetlabs/rabbitmq', '>= 2.0.2'
|
||||
dependency 'puppetlabs/stdlib', '>= 2.4.0'
|
||||
dependency 'duritong/sysctl', '>= 0.0.1'
|
||||
dependency 'cprice404/inifile', '>= 0.9.0'
|
||||
dependency 'dprince/qpid', '>= 1.0.0'
|
||||
|
||||
@@ -33,6 +33,7 @@ class nova(
|
||||
# this is how to query all resources from our clutser
|
||||
$nova_cluster_id='localcluster',
|
||||
$sql_connection = false,
|
||||
$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
|
||||
@@ -43,6 +44,19 @@ class nova(
|
||||
$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',
|
||||
@@ -150,30 +164,51 @@ class nova(
|
||||
|
||||
nova_config { 'auth_strategy': value => $auth_strategy }
|
||||
|
||||
if size($rabbit_hosts) > 1 {
|
||||
nova_config { 'rabbit_ha_queues': value => 'true' }
|
||||
} else {
|
||||
nova_config { 'rabbit_ha_queues': value => 'false' }
|
||||
if $rpc_backend == 'nova.openstack.common.rpc.impl_kombu' {
|
||||
# I may want to support exporting and collecting these
|
||||
nova_config {
|
||||
'rabbit_password': value => $rabbit_password;
|
||||
'rabbit_userid': value => $rabbit_userid;
|
||||
'rabbit_virtual_host': value => $rabbit_virtual_host;
|
||||
}
|
||||
|
||||
if size($rabbit_hosts) > 1 {
|
||||
nova_config { 'rabbit_ha_queues': value => 'true' }
|
||||
} else {
|
||||
nova_config { 'rabbit_ha_queues': value => 'false' }
|
||||
}
|
||||
|
||||
if $rabbit_hosts {
|
||||
nova_config { 'rabbit_hosts': value => join($rabbit_hosts, ',') }
|
||||
} elsif $rabbit_host {
|
||||
nova_config { 'rabbit_host': value => $rabbit_host }
|
||||
nova_config { 'rabbit_port': value => $rabbit_port }
|
||||
nova_config { 'rabbit_hosts': value => "${rabbit_host}:${rabbit_port}" }
|
||||
}
|
||||
}
|
||||
|
||||
if $rabbit_hosts {
|
||||
nova_config { 'rabbit_hosts': value => join($rabbit_hosts, ',') }
|
||||
} elsif $rabbit_host {
|
||||
nova_config { 'rabbit_host': value => $rabbit_host }
|
||||
nova_config { 'rabbit_port': value => $rabbit_port }
|
||||
nova_config { 'rabbit_hosts': value => "${rabbit_host}:${rabbit_port}" }
|
||||
}
|
||||
|
||||
# I may want to support exporting and collecting these
|
||||
nova_config {
|
||||
'rabbit_password': value => $rabbit_password;
|
||||
'rabbit_userid': value => $rabbit_userid;
|
||||
'rabbit_virtual_host': value => $rabbit_virtual_host;
|
||||
if $rpc_backend == 'nova.openstack.common.rpc.impl_qpid' {
|
||||
nova_config {
|
||||
'qpid_hostname': value => $qpid_hostname;
|
||||
'qpid_port': value => $qpid_port;
|
||||
'qpid_username': value => $qpid_username;
|
||||
'qpid_password': value => $qpid_password;
|
||||
'qpid_reconnect': value => $qpid_reconnect;
|
||||
'qpid_reconnect_timeout': value => $qpid_reconnect_timeout;
|
||||
'qpid_reconnect_limit': value => $qpid_reconnect_limit;
|
||||
'qpid_reconnect_interval_min': value => $qpid_reconnect_interval_min;
|
||||
'qpid_reconnect_interval_max': value => $qpid_reconnect_interval_max;
|
||||
'qpid_reconnect_interval': value => $qpid_reconnect_interval;
|
||||
'qpid_heartbeat': value => $qpid_heartbeat;
|
||||
'qpid_protocol': value => $qpid_protocol;
|
||||
'qpid_tcp_nodelay': value => $qpid_tcp_nodelay;
|
||||
}
|
||||
}
|
||||
|
||||
nova_config {
|
||||
'verbose': value => $verbose;
|
||||
'logdir': value => $logdir;
|
||||
'rpc_backend': value => $rpc_backend;
|
||||
# Following may need to be broken out to different nova services
|
||||
'state_path': value => $state_path;
|
||||
'lock_path': value => $lock_path;
|
||||
@@ -181,14 +216,12 @@ class nova(
|
||||
'rootwrap_config': value => $rootwrap_config;
|
||||
}
|
||||
|
||||
|
||||
if $monitoring_notifications {
|
||||
nova_config {
|
||||
'notification_driver': value => 'nova.notifier.rabbit_notifier'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
exec { 'post-nova_config':
|
||||
command => '/bin/echo "Nova config has changed"',
|
||||
refreshonly => true,
|
||||
|
||||
35
manifests/qpid.pp
Normal file
35
manifests/qpid.pp
Normal file
@@ -0,0 +1,35 @@
|
||||
#
|
||||
# class for installing qpid server for nova
|
||||
#
|
||||
#
|
||||
class nova::qpid(
|
||||
$enabled = true,
|
||||
$user='guest',
|
||||
$password='guest',
|
||||
$file='/var/lib/qpidd/qpidd.sasldb',
|
||||
$realm='OPENSTACK'
|
||||
) {
|
||||
|
||||
# only configure nova after the queue is up
|
||||
Class['qpid::server'] -> Package<| title == 'nova-common' |>
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
}
|
||||
@@ -62,6 +62,7 @@ describe 'nova' do
|
||||
it { should contain_nova_config('auth_strategy').with_value('keystone') }
|
||||
it { should_not contain_nova_config('use_deprecated_auth').with_value('false') }
|
||||
|
||||
it { should contain_nova_config('rpc_backend').with_value('nova.openstack.common.rpc.impl_kombu') }
|
||||
it { should contain_nova_config('rabbit_host').with_value('localhost') }
|
||||
it { should contain_nova_config('rabbit_password').with_value('guest') }
|
||||
it { should contain_nova_config('rabbit_port').with_value('5672') }
|
||||
@@ -107,6 +108,7 @@ describe 'nova' do
|
||||
|
||||
it { should contain_nova_config('auth_strategy').with_value('foo') }
|
||||
it { should_not contain_nova_config('use_deprecated_auth').with_value(true) }
|
||||
it { should contain_nova_config('rpc_backend').with_value('nova.openstack.common.rpc.impl_kombu') }
|
||||
it { should contain_nova_config('rabbit_host').with_value('rabbit') }
|
||||
it { should contain_nova_config('rabbit_password').with_value('password') }
|
||||
it { should contain_nova_config('rabbit_port').with_value('5673') }
|
||||
@@ -138,6 +140,56 @@ describe 'nova' do
|
||||
|
||||
end
|
||||
|
||||
|
||||
describe 'with qpid rpc supplied' do
|
||||
|
||||
let :params do
|
||||
{
|
||||
'sql_connection' => 'mysql://user:pass@db/db',
|
||||
'verbose' => true,
|
||||
'logdir' => '/var/log/nova2',
|
||||
'image_service' => 'nova.image.local.LocalImageService',
|
||||
'rpc_backend' => 'nova.openstack.common.rpc.impl_qpid',
|
||||
'lock_path' => '/var/locky/path',
|
||||
'state_path' => '/var/lib/nova2',
|
||||
'service_down_time' => '120',
|
||||
'auth_strategy' => 'foo',
|
||||
'ensure_package' => '2012.1.1-15.el6'
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_package('nova-common').with('ensure' => '2012.1.1-15.el6') }
|
||||
it { should contain_package('python-nova').with('ensure' => '2012.1.1-15.el6') }
|
||||
it { should contain_nova_config('sql_connection').with_value('mysql://user:pass@db/db') }
|
||||
|
||||
it { should contain_nova_config('image_service').with_value('nova.image.local.LocalImageService') }
|
||||
it { should_not contain_nova_config('glance_api_servers') }
|
||||
|
||||
it { should contain_nova_config('auth_strategy').with_value('foo') }
|
||||
it { should_not contain_nova_config('use_deprecated_auth').with_value(true) }
|
||||
it { should contain_nova_config('rpc_backend').with_value('nova.openstack.common.rpc.impl_qpid') }
|
||||
it { should contain_nova_config('qpid_hostname').with_value('localhost') }
|
||||
it { should contain_nova_config('qpid_port').with_value('5672') }
|
||||
it { should contain_nova_config('qpid_username').with_value('guest') }
|
||||
it { should contain_nova_config('qpid_password').with_value('guest') }
|
||||
it { should contain_nova_config('qpid_reconnect').with_value('true') }
|
||||
it { should contain_nova_config('qpid_reconnect_timeout').with_value('0') }
|
||||
it { should contain_nova_config('qpid_reconnect_limit').with_value('0') }
|
||||
it { should contain_nova_config('qpid_reconnect_interval_min').with_value('0') }
|
||||
it { should contain_nova_config('qpid_reconnect_interval_max').with_value('0') }
|
||||
it { should contain_nova_config('qpid_reconnect_interval').with_value('0') }
|
||||
it { should contain_nova_config('qpid_heartbeat').with_value('60') }
|
||||
it { should contain_nova_config('qpid_protocol').with_value('tcp') }
|
||||
it { should contain_nova_config('qpid_tcp_nodelay').with_value('true') }
|
||||
|
||||
it { should contain_nova_config('verbose').with_value(true) }
|
||||
it { should contain_nova_config('logdir').with_value('/var/log/nova2') }
|
||||
it { should contain_nova_config('state_path').with_value('/var/lib/nova2') }
|
||||
it { should contain_nova_config('lock_path').with_value('/var/locky/path') }
|
||||
it { should contain_nova_config('service_down_time').with_value('120') }
|
||||
|
||||
end
|
||||
|
||||
describe "When platform is RedHat" do
|
||||
let :facts do
|
||||
{:osfamily => 'RedHat'}
|
||||
|
||||
50
spec/classes/nova_qpid_spec.rb
Normal file
50
spec/classes/nova_qpid_spec.rb
Normal file
@@ -0,0 +1,50 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'nova::qpid' do
|
||||
|
||||
let :facts do
|
||||
{:puppetversion => '2.7'}
|
||||
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
|
||||
Reference in New Issue
Block a user