From df77db29092b02bd1bbd683830b6f40291874e40 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Fri, 27 May 2016 10:48:33 -0400 Subject: [PATCH] Add transport_url parameter for oslo.messaging This commit adds the transport_url parameter for oslo.messaging. The url is of the form: transport://user:pass@host1:port[,hostN:portN]/virtual_host Where the transport scheme specifies the rpc or notification backend as one of rabbit, amqp, zmq, etc. Oslo.messaging is deprecating the host, port, and auth configuration options [1]. All drivers will get these options via the transport_url. This patch: * use oslo::messaging::default resource * add parameter for transport_url * update spec test * add feature release note [1] https://review.openstack.org/#/c/317285/ Change-Id: I210c2c6c87600f3bd92e23d23b630f297220e091 --- manifests/init.pp | 14 ++++++++++++-- ...d_messaging_transport_url-15c22b42e7e929de.yaml | 3 +++ spec/classes/neutron_init_spec.rb | 14 ++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/add_messaging_transport_url-15c22b42e7e929de.yaml diff --git a/manifests/init.pp b/manifests/init.pp index 8731e96fd..b3563953f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -120,7 +120,13 @@ # [*control_exchange*] # (optional) What RPC queue/exchange to use # Defaults to neutron - +# +# [*default_transport_url*] +# (optional) A URL representing the messaging driver to use and its full +# configuration. Transport URLs take the form: +# transport://user:pass@host1:port[,hostN:portN]/virtual_host +# Defaults to $::os_service_default +# # [*rpc_backend*] # (optional) what rpc/queuing service to use # Defaults to $::os_service_default @@ -340,7 +346,9 @@ # # [*notification_transport_url*] # (optional) A URL representing the messaging driver to use for -# notifications. +# notifications and its full configuration. Transport URLs +# take the form: +# transport://user:pass@host1:port[,hostN:portN]/virtual_host # Defaults to $::os_service_default. # # DEPRECATED PARAMETERS @@ -385,6 +393,7 @@ class neutron ( $report_interval = $::os_service_default, $memcache_servers = false, $control_exchange = 'neutron', + $default_transport_url = $::os_service_default, $rpc_backend = $::os_service_default, $rpc_response_timeout = $::os_service_default, $rabbit_password = $::os_service_default, @@ -523,6 +532,7 @@ class neutron ( } oslo::messaging::default { 'neutron_config': + transport_url => $default_transport_url, rpc_response_timeout => $rpc_response_timeout, control_exchange => $control_exchange } diff --git a/releasenotes/notes/add_messaging_transport_url-15c22b42e7e929de.yaml b/releasenotes/notes/add_messaging_transport_url-15c22b42e7e929de.yaml new file mode 100644 index 000000000..08f8df0b4 --- /dev/null +++ b/releasenotes/notes/add_messaging_transport_url-15c22b42e7e929de.yaml @@ -0,0 +1,3 @@ +--- +features: + - Add oslo.messaging transport_url parameter via puppet-oslo resource \ No newline at end of file diff --git a/spec/classes/neutron_init_spec.rb b/spec/classes/neutron_init_spec.rb index 9651d6e72..7e0a15f15 100644 --- a/spec/classes/neutron_init_spec.rb +++ b/spec/classes/neutron_init_spec.rb @@ -82,6 +82,7 @@ describe 'neutron' do it_configures 'without memcache_servers' it_configures 'with memcache_servers' it_configures 'with dns_domain defined' + it_configures 'with transport_url defined' context 'with amqp rpc_backend value' do it_configures 'amqp support' @@ -146,6 +147,7 @@ describe 'neutron' do is_expected.to contain_neutron_config('DEFAULT/control_exchange').with_value('neutron') is_expected.to contain_neutron_config('DEFAULT/state_path').with_value('') is_expected.to contain_neutron_config('oslo_concurrency/lock_path').with_value('$state_path/lock') + is_expected.to contain_neutron_config('DEFAULT/transport_url').with_value('') is_expected.to contain_neutron_config('DEFAULT/rpc_response_timeout').with_value( '' ) is_expected.to contain_neutron_config('agent/root_helper').with_value('sudo neutron-rootwrap /etc/neutron/rootwrap.conf') is_expected.to contain_neutron_config('agent/report_interval').with_value('') @@ -450,6 +452,18 @@ describe 'neutron' do end end + shared_examples_for 'with transport_url defined' do + before do + params.merge!( + :default_transport_url => 'rabbit://rabbit_user:password@localhost:5673' + ) + end + + it do + is_expected.to contain_neutron_config('DEFAULT/transport_url').with_value(params[:default_transport_url]) + end + end + shared_examples_for 'amqp support' do context 'with default parameters' do before { params.merge!( :rpc_backend => 'amqp' ) }