From 68494cfa06aca3b6d2aa092d4c1a1d88ba88b9b4 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Tue, 31 May 2016 16:43:56 -0400 Subject: [PATCH] Add transport_url parameters for oslo.messaging This commit adds the transport_url parameters 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 * use oslo::messaging::notifications resource * add parameters for transport_url(s) * update spec tests * add feature release note [1] https://review.openstack.org/#/c/317285/ Change-Id: I6f58a4da46a44ec20b256f08108b3b045f1c55ee --- manifests/init.pp | 27 +++++++++++++++---- ...sport_url_parameters-675ef5f76fc5e8d2.yaml | 3 +++ spec/classes/manila_spec.rb | 19 +++++++++++++ 3 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 releasenotes/notes/add_transport_url_parameters-675ef5f76fc5e8d2.yaml diff --git a/manifests/init.pp b/manifests/init.pp index 7c0de562..b3759c40 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -35,6 +35,12 @@ # (optional) Directory for storing state. # Defaults to '/var/lib/manila' # +# [*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 +# # [*control_exchange*] # (Optional) The default exchange under which topics are scope. # Defaults to 'openstack'. @@ -47,6 +53,13 @@ # (Optional) Ensure state for package. # Defaults to 'present' # +# [*notification_transport_url*] +# (optional) A URL representing the messaging driver to use for +# notifications and its full configuration. Transport URLs +# take the form: +# transport://user:pass@host1:port[,hostN:portN]/virtual_host +# Defaults to $::os_service_default. +# # [*notification_driver*] # (optional) Driver or drivers to handle sending notifications. # Defaults to 'messaging' @@ -237,7 +250,9 @@ class manila ( $database_max_pool_size = undef, $database_max_overflow = undef, $rpc_backend = 'rabbit', + $default_transport_url = $::os_service_default, $control_exchange = 'openstack', + $notification_transport_url = $::os_service_default, $notification_driver = 'messaging', $rabbit_host = $::os_service_default, $rabbit_port = $::os_service_default, @@ -335,10 +350,6 @@ class manila ( kombu_ssl_keyfile => $kombu_ssl_keyfile, kombu_ssl_version => $kombu_ssl_version, } - - oslo::messaging::notifications { 'manila_config': - driver => $notification_driver - } } elsif $rpc_backend == 'amqp' { @@ -364,7 +375,13 @@ class manila ( } oslo::messaging::default { 'manila_config': - control_exchange => $control_exchange + transport_url => $default_transport_url, + control_exchange => $control_exchange, + } + + oslo::messaging::notifications { 'manila_config': + transport_url => $notification_transport_url, + driver => $notification_driver, } manila_config { diff --git a/releasenotes/notes/add_transport_url_parameters-675ef5f76fc5e8d2.yaml b/releasenotes/notes/add_transport_url_parameters-675ef5f76fc5e8d2.yaml new file mode 100644 index 00000000..a7213685 --- /dev/null +++ b/releasenotes/notes/add_transport_url_parameters-675ef5f76fc5e8d2.yaml @@ -0,0 +1,3 @@ +--- +features: + - Add oslo.messaging transport_url parameters via puppet-oslo resource \ No newline at end of file diff --git a/spec/classes/manila_spec.rb b/spec/classes/manila_spec.rb index 4e1504d7..a53c98c3 100644 --- a/spec/classes/manila_spec.rb +++ b/spec/classes/manila_spec.rb @@ -20,6 +20,12 @@ describe 'manila' do is_expected.to contain_manila_config('DEFAULT/rpc_backend').with( :value => 'rabbit' ) + is_expected.to contain_manila_config('DEFAULT/transport_url').with( + :value => '' + ) + is_expected.to contain_manila_config('oslo_messaging_notifications/transport_url').with( + :value => '' + ) is_expected.to contain_manila_config('oslo_messaging_notifications/driver').with( :value => 'messaging' ) @@ -257,6 +263,19 @@ describe 'manila' do it_raises 'a Puppet::Error', /The cert_file parameter is required when use_ssl is set to true/ end + describe 'with transport_url entries' do + + let :params do + { + :default_transport_url => 'rabbit://rabbit_user:password@localhost:5673', + :notification_transport_url => 'rabbit://rabbit_user:password@localhost:5673', + } + end + + it { is_expected.to contain_manila_config('DEFAULT/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673') } + it { is_expected.to contain_manila_config('oslo_messaging_notifications/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673') } + end + describe 'with amqp rpc supplied' do let :params do