From fef877e61d11eaed56c8be88de0a8ec0bc3c5e02 Mon Sep 17 00:00:00 2001 From: Alex Schultz Date: Tue, 8 Nov 2016 15:07:17 -0700 Subject: [PATCH] Deprecate rabbitmq connection parameters The rabbitmq connection parameters have been deprecated in favor of the transport_url setting. Change-Id: If4dfe8b82518fc4e590731a805ee3115b11f4f47 Related-Bug: #1625198 --- manifests/agents/ml2/linuxbridge.pp | 5 +- manifests/init.pp | 61 +++++++++++-------- ...n-params-deprecation-8f22be73c012f001.yaml | 6 ++ spec/acceptance/basic_neutron_spec.rb | 4 +- 4 files changed, 47 insertions(+), 29 deletions(-) create mode 100644 releasenotes/notes/rabbit-connection-params-deprecation-8f22be73c012f001.yaml diff --git a/manifests/agents/ml2/linuxbridge.pp b/manifests/agents/ml2/linuxbridge.pp index 2cccfdeed..4564c4798 100644 --- a/manifests/agents/ml2/linuxbridge.pp +++ b/manifests/agents/ml2/linuxbridge.pp @@ -158,7 +158,10 @@ class neutron::agents::ml2::linuxbridge ( } if $::neutron::rpc_backend == 'neutron.openstack.common.rpc.impl_kombu' { - $linuxbridge_agent_subscribe = Neutron_config['oslo_messaging_rabbit/rabbit_hosts'] + $linuxbridge_agent_subscribe = [ + Neutron_config['oslo_messaging_rabbit/rabbit_hosts'], + Neutron_config['DEFAULT/transport_url'] + ] } else { $linuxbridge_agent_subscribe = undef } diff --git a/manifests/init.pp b/manifests/init.pp index 13be636a8..7eeab86ef 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -128,23 +128,6 @@ # (optional) Seconds to wait for a response from a call # Defaults to $::os_service_default # -# [*rabbit_password*] -# [*rabbit_host*] -# [*rabbit_port*] -# [*rabbit_user*] -# (optional) Various rabbitmq settings -# Defaults to $::os_service_default -# -# [*rabbit_virtual_host*] -# (optional) virtualhost to use. -# Defaults to $::os_service_default -# -# [*rabbit_hosts*] -# (optional) array of rabbitmq servers for HA. -# A single IP address, such as a VIP, can be used for load-balancing -# multiple RabbitMQ Brokers. -# Defaults to $::os_service_default -# # [*rabbit_ha_queues*] # (Optional) Use HA queues in RabbitMQ. # Defaults to $::os_service_default @@ -375,6 +358,23 @@ # [*memcache_servers*] # (optional) This option is deprecated an has no effect. # +# [*rabbit_password*] +# [*rabbit_host*] +# [*rabbit_port*] +# [*rabbit_user*] +# (optional) Various rabbitmq settings +# Defaults to $::os_service_default +# +# [*rabbit_virtual_host*] +# (optional) virtualhost to use. +# Defaults to $::os_service_default +# +# [*rabbit_hosts*] +# (optional) array of rabbitmq servers for HA. +# A single IP address, such as a VIP, can be used for load-balancing +# multiple RabbitMQ Brokers. +# Defaults to $::os_service_default +# class neutron ( $enabled = true, $package_ensure = 'present', @@ -402,13 +402,7 @@ class neutron ( $default_transport_url = $::os_service_default, $rpc_backend = $::os_service_default, $rpc_response_timeout = $::os_service_default, - $rabbit_password = $::os_service_default, - $rabbit_host = $::os_service_default, - $rabbit_hosts = $::os_service_default, - $rabbit_port = $::os_service_default, $rabbit_ha_queues = $::os_service_default, - $rabbit_user = $::os_service_default, - $rabbit_virtual_host = $::os_service_default, $rabbit_heartbeat_timeout_threshold = $::os_service_default, $rabbit_heartbeat_rate = $::os_service_default, $rabbit_use_ssl = $::os_service_default, @@ -459,6 +453,12 @@ class neutron ( $allow_pagination = undef, $allow_sorting = undef, $memcache_servers = undef, + $rabbit_password = $::os_service_default, + $rabbit_host = $::os_service_default, + $rabbit_hosts = $::os_service_default, + $rabbit_port = $::os_service_default, + $rabbit_user = $::os_service_default, + $rabbit_virtual_host = $::os_service_default, ) { include ::neutron::deps @@ -511,6 +511,17 @@ class neutron ( warning('memcache_servers option is deprecated, has no effect and will be removed after Ocata.') } + if !is_service_default($rabbit_host) or + !is_service_default($rabbit_hosts) or + !is_service_default($rabbit_password) or + !is_service_default($rabbit_port) or + !is_service_default($rabbit_user) or + !is_service_default($rabbit_virtual_host) { + warning("neutron::rabbit_host, neutron::rabbit_hosts, neutron::rabbit_password, \ +neutron::rabbit_port, neutron::rabbit_user and neutron::rabbit_virtual_host are \ +deprecated. Please use neutron::default_transport_url instead.") + } + package { 'neutron': ensure => $package_ensure, name => $::neutron::params::package_name, @@ -546,7 +557,7 @@ class neutron ( oslo::messaging::default { 'neutron_config': transport_url => $default_transport_url, rpc_response_timeout => $rpc_response_timeout, - control_exchange => $control_exchange + control_exchange => $control_exchange, } oslo::concurrency { 'neutron_config': lock_path => $lock_path } @@ -566,7 +577,7 @@ class neutron ( } if $rpc_backend in [$::os_service_default, 'neutron.openstack.common.rpc.impl_kombu', 'rabbit'] { - if is_service_default($rabbit_password) { + if is_service_default($default_transport_url) and is_service_default($rabbit_password) { fail('When rpc_backend is rabbitmq, you must set rabbit password') } diff --git a/releasenotes/notes/rabbit-connection-params-deprecation-8f22be73c012f001.yaml b/releasenotes/notes/rabbit-connection-params-deprecation-8f22be73c012f001.yaml new file mode 100644 index 000000000..eb6734408 --- /dev/null +++ b/releasenotes/notes/rabbit-connection-params-deprecation-8f22be73c012f001.yaml @@ -0,0 +1,6 @@ +--- +deprecations: + - neutron::rabbit_host, neutron::rabbit_hosts, neutron::rabbit_password, + neutron::rabbit_port, neutron::rabbit_user and + neutron::rabbit_virtual_host are deprecated. + neutron::default_transport_url should be used instead. diff --git a/spec/acceptance/basic_neutron_spec.rb b/spec/acceptance/basic_neutron_spec.rb index a968516aa..f1cdb4c1e 100644 --- a/spec/acceptance/basic_neutron_spec.rb +++ b/spec/acceptance/basic_neutron_spec.rb @@ -30,9 +30,7 @@ describe 'basic neutron' do # Neutron resources class { '::neutron': - rabbit_user => 'neutron', - rabbit_password => 'an_even_bigger_secret', - rabbit_host => '127.0.0.1', + default_transport_url => 'rabbit://neutron:an_even_bigger_secret@127.0.0.1:5672/', allow_overlapping_ips => true, core_plugin => 'ml2', debug => true,