Allow guestagent to use different rabbit params

In some environments, Trove guests will talk to rabbit via a different
gateway or VIP and possibly using a different port. This might be done
for security or separation reasons. This change allows the guestagent's
rabbit host(s) and port information to be different than that from the
main cluster.

Change-Id: I2107edd579073d81496821a8ecf23a3c2039b75d
This commit is contained in:
Matt Fischer 2016-05-04 11:53:25 -06:00
parent 2e795ef596
commit 57b14b0158
3 changed files with 44 additions and 5 deletions

View File

@ -54,6 +54,27 @@
# (optional) Control exchange. # (optional) Control exchange.
# Defaults to 'trove'. # Defaults to 'trove'.
# #
# [*rabbit_hosts*]
# (optional) List of clustered rabbit servers.
# Defaults to the value set in the trove class.
# The default can generally be left unless the
# guests need to talk to the rabbit cluster via
# different IPs.
#
# [*rabbit_host*]
# (optional) Location of rabbitmq installation.
# Defaults to the value set in the trove class.
# The default can generally be left unless the
# guests need to talk to the rabbit cluster via
# a different IP.
#
# [*rabbit_port*]
# (optional) Port for rabbitmq instance.
# Defaults to the value set in the trove class.
# The default can generally be left unless the
# guests need to talk to the rabbit cluster via
# a different port.
#
class trove::guestagent( class trove::guestagent(
$enabled = true, $enabled = true,
$manage_service = true, $manage_service = true,
@ -66,7 +87,10 @@ class trove::guestagent(
$log_facility = 'LOG_USER', $log_facility = 'LOG_USER',
$auth_url = 'http://localhost:5000/v2.0', $auth_url = 'http://localhost:5000/v2.0',
$swift_url = 'http://localhost:8080/v1/AUTH_', $swift_url = 'http://localhost:8080/v1/AUTH_',
$control_exchange = 'trove' $control_exchange = 'trove',
$rabbit_hosts = $::trove::rabbit_hosts,
$rabbit_host = $::trove::rabbit_host,
$rabbit_port = $::trove::rabbit_port,
) inherits trove { ) inherits trove {
include ::trove::deps include ::trove::deps
@ -96,9 +120,9 @@ class trove::guestagent(
if $::trove::rpc_backend == 'trove.openstack.common.rpc.impl_kombu' or $::trove::rpc_backend == 'rabbit' { if $::trove::rpc_backend == 'trove.openstack.common.rpc.impl_kombu' or $::trove::rpc_backend == 'rabbit' {
oslo::messaging::rabbit {'trove_guestagent_config': oslo::messaging::rabbit {'trove_guestagent_config':
rabbit_hosts => $::trove::rabbit_hosts, rabbit_hosts => $rabbit_hosts,
rabbit_host => $::trove::rabbit_host, rabbit_host => $rabbit_host,
rabbit_port => $::trove::rabbit_port, rabbit_port => $rabbit_port,
rabbit_ha_queues => $::trove::rabbit_ha_queues, rabbit_ha_queues => $::trove::rabbit_ha_queues,
rabbit_userid => $::trove::rabbit_userid, rabbit_userid => $::trove::rabbit_userid,
rabbit_password => $::trove::rabbit_password, rabbit_password => $::trove::rabbit_password,

View File

@ -0,0 +1,7 @@
---
features:
- In some environments, Trove guests will talk to rabbit via a different
gateway or VIP and possibly using a different port. This might be done
for security or separation reasons. This change allows the guestagent's
rabbit host(s) and port information to be different than that from the
main cluster.

View File

@ -32,6 +32,9 @@ describe 'trove::guestagent' do
is_expected.to contain_trove_guestagent_config('DEFAULT/os_region_name').with_value('RegionOne') is_expected.to contain_trove_guestagent_config('DEFAULT/os_region_name').with_value('RegionOne')
is_expected.to contain_trove_guestagent_config('oslo_messaging_notifications/driver').with_value('<SERVICE DEFAULT>') is_expected.to contain_trove_guestagent_config('oslo_messaging_notifications/driver').with_value('<SERVICE DEFAULT>')
is_expected.to contain_trove_guestagent_config('oslo_messaging_notifications/topics').with_value('<SERVICE DEFAULT>') is_expected.to contain_trove_guestagent_config('oslo_messaging_notifications/topics').with_value('<SERVICE DEFAULT>')
is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_host').with_value('<SERVICE DEFAULT>')
is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_hosts').with_value('<SERVICE DEFAULT>')
is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_port').with_value('<SERVICE DEFAULT>')
is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_userid').with_value('<SERVICE DEFAULT>') is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_userid').with_value('<SERVICE DEFAULT>')
is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_password').with_value('<SERVICE DEFAULT>') is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_password').with_value('<SERVICE DEFAULT>')
is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('<SERVICE DEFAULT>') is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('<SERVICE DEFAULT>')
@ -89,11 +92,16 @@ describe 'trove::guestagent' do
let :params do let :params do
{ :auth_url => "http://10.0.0.1:5000/v2.0", { :auth_url => "http://10.0.0.1:5000/v2.0",
:swift_url => "http://10.0.0.1:8080/v1/AUTH_" } :swift_url => "http://10.0.0.1:8080/v1/AUTH_",
:rabbit_host => '10.1.0.1',
:rabbit_port => '5673'
}
end end
it 'configures trove-guestagent with custom parameters' do it 'configures trove-guestagent with custom parameters' do
is_expected.to contain_trove_guestagent_config('DEFAULT/trove_auth_url').with_value('http://10.0.0.1:5000/v2.0') is_expected.to contain_trove_guestagent_config('DEFAULT/trove_auth_url').with_value('http://10.0.0.1:5000/v2.0')
is_expected.to contain_trove_guestagent_config('DEFAULT/swift_url').with_value('http://10.0.0.1:8080/v1/AUTH_') is_expected.to contain_trove_guestagent_config('DEFAULT/swift_url').with_value('http://10.0.0.1:8080/v1/AUTH_')
is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_host').with_value('10.1.0.1')
is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_port').with_value('5673')
end end
end end