Add possibility to use list of qpid hosts in cinder
adding qpid_hosts parameter in oslo messaging section qpid_hosts parameter is a list of Qpid HA cluster host:port pairs. Change-Id: I596bdb06a9c7335e49053b56add72b7deeebc041
This commit is contained in:
parent
3129186017
commit
ae5a38efde
@ -104,6 +104,10 @@
|
||||
# (Optional) Port for qpid server.
|
||||
# Defaults to '5672'.
|
||||
#
|
||||
# [*qpid_hosts*]
|
||||
# (Optional) Qpid HA cluster host:port pairs. (list value)
|
||||
# Defaults to false
|
||||
#
|
||||
# [*qpid_username*]
|
||||
# (Optional) Username to use when connecting to qpid.
|
||||
# Defaults to 'guest'.
|
||||
@ -259,6 +263,7 @@ class cinder (
|
||||
$amqp_durable_queues = false,
|
||||
$qpid_hostname = 'localhost',
|
||||
$qpid_port = '5672',
|
||||
$qpid_hosts = false,
|
||||
$qpid_username = 'guest',
|
||||
$qpid_password = false,
|
||||
$qpid_sasl_mechanisms = false,
|
||||
@ -357,8 +362,6 @@ class cinder (
|
||||
}
|
||||
|
||||
cinder_config {
|
||||
'oslo_messaging_qpid/qpid_hostname': value => $qpid_hostname;
|
||||
'oslo_messaging_qpid/qpid_port': value => $qpid_port;
|
||||
'oslo_messaging_qpid/qpid_username': value => $qpid_username;
|
||||
'oslo_messaging_qpid/qpid_password': value => $qpid_password, secret => true;
|
||||
'oslo_messaging_qpid/qpid_reconnect': value => $qpid_reconnect;
|
||||
@ -373,6 +376,14 @@ class cinder (
|
||||
'oslo_messaging_qpid/amqp_durable_queues': value => $amqp_durable_queues;
|
||||
}
|
||||
|
||||
if $qpid_hosts {
|
||||
cinder_config { 'oslo_messaging_qpid/qpid_hosts': value => join(any2array($qpid_hosts), ',') }
|
||||
} else {
|
||||
cinder_config { 'oslo_messaging_qpid/qpid_hosts': value => "${qpid_hostname}:${qpid_port}" }
|
||||
cinder_config { 'oslo_messaging_qpid/qpid_hostname': value => $qpid_hostname }
|
||||
cinder_config { 'oslo_messaging_qpid/qpid_port': value => $qpid_port }
|
||||
}
|
||||
|
||||
if is_array($qpid_sasl_mechanisms) {
|
||||
cinder_config {
|
||||
'DEFAULT/qpid_sasl_mechanisms': value => join($qpid_sasl_mechanisms, ' ');
|
||||
|
@ -95,6 +95,7 @@ describe 'cinder' do
|
||||
it { is_expected.to contain_cinder_config('DEFAULT/rpc_backend').with_value('qpid') }
|
||||
it { is_expected.to contain_cinder_config('oslo_messaging_qpid/qpid_hostname').with_value('localhost') }
|
||||
it { is_expected.to contain_cinder_config('oslo_messaging_qpid/qpid_port').with_value('5672') }
|
||||
it { is_expected.to contain_cinder_config('oslo_messaging_qpid/qpid_hosts').with_value('localhost:5672') }
|
||||
it { is_expected.to contain_cinder_config('oslo_messaging_qpid/qpid_username').with_value('guest') }
|
||||
it { is_expected.to contain_cinder_config('oslo_messaging_qpid/qpid_password').with_value('guest').with_secret(true) }
|
||||
it { is_expected.to contain_cinder_config('oslo_messaging_qpid/qpid_reconnect').with_value(true) }
|
||||
@ -108,6 +109,36 @@ describe 'cinder' do
|
||||
it { is_expected.to contain_cinder_config('oslo_messaging_qpid/qpid_tcp_nodelay').with_value(true) }
|
||||
end
|
||||
|
||||
describe 'with modified qpid_hosts' do
|
||||
let :params do
|
||||
{
|
||||
:database_connection => 'mysql://user:password@host/database',
|
||||
:qpid_password => 'guest',
|
||||
:rpc_backend => 'qpid',
|
||||
:qpid_hosts => ['qpid1:5672', 'qpid2:5672']
|
||||
}
|
||||
end
|
||||
|
||||
it 'should contain many' do
|
||||
is_expected.to contain_cinder_config('oslo_messaging_qpid/qpid_hosts').with(:value => 'qpid1:5672,qpid2:5672')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with a single qpid_hosts entry' do
|
||||
let :params do
|
||||
{
|
||||
:database_connection => 'mysql://user:password@host/database',
|
||||
:qpid_password => 'guest',
|
||||
:rpc_backend => 'qpid',
|
||||
:qpid_hosts => ['qpid1:5672']
|
||||
}
|
||||
end
|
||||
|
||||
it 'should contain one' do
|
||||
is_expected.to contain_cinder_config('oslo_messaging_qpid/qpid_hosts').with(:value => 'qpid1:5672')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with qpid rpc and no qpid_sasl_mechanisms' do
|
||||
let :params do
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user