From 57b14b015890e7edd40e00b27f826908a6db6a42 Mon Sep 17 00:00:00 2001 From: Matt Fischer Date: Wed, 4 May 2016 11:53:25 -0600 Subject: [PATCH] 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 --- manifests/guestagent.pp | 32 ++++++++++++++++--- ...erride-rabbit-params-eaf20f06fad960c5.yaml | 7 ++++ spec/classes/trove_guestagent_spec.rb | 10 +++++- 3 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 releasenotes/notes/guestagent-override-rabbit-params-eaf20f06fad960c5.yaml diff --git a/manifests/guestagent.pp b/manifests/guestagent.pp index 342e5b50..16f9a6b3 100644 --- a/manifests/guestagent.pp +++ b/manifests/guestagent.pp @@ -54,6 +54,27 @@ # (optional) Control exchange. # 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( $enabled = true, $manage_service = true, @@ -66,7 +87,10 @@ class trove::guestagent( $log_facility = 'LOG_USER', $auth_url = 'http://localhost:5000/v2.0', $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 { 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' { oslo::messaging::rabbit {'trove_guestagent_config': - rabbit_hosts => $::trove::rabbit_hosts, - rabbit_host => $::trove::rabbit_host, - rabbit_port => $::trove::rabbit_port, + rabbit_hosts => $rabbit_hosts, + rabbit_host => $rabbit_host, + rabbit_port => $rabbit_port, rabbit_ha_queues => $::trove::rabbit_ha_queues, rabbit_userid => $::trove::rabbit_userid, rabbit_password => $::trove::rabbit_password, diff --git a/releasenotes/notes/guestagent-override-rabbit-params-eaf20f06fad960c5.yaml b/releasenotes/notes/guestagent-override-rabbit-params-eaf20f06fad960c5.yaml new file mode 100644 index 00000000..e289736b --- /dev/null +++ b/releasenotes/notes/guestagent-override-rabbit-params-eaf20f06fad960c5.yaml @@ -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. diff --git a/spec/classes/trove_guestagent_spec.rb b/spec/classes/trove_guestagent_spec.rb index 9eb9fd93..06cf1658 100644 --- a/spec/classes/trove_guestagent_spec.rb +++ b/spec/classes/trove_guestagent_spec.rb @@ -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('oslo_messaging_notifications/driver').with_value('') is_expected.to contain_trove_guestagent_config('oslo_messaging_notifications/topics').with_value('') + is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_host').with_value('') + is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_hosts').with_value('') + is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_port').with_value('') is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_userid').with_value('') is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_password').with_value('') is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('') @@ -89,11 +92,16 @@ describe 'trove::guestagent' do let :params do { :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 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/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