From 68da464eaee248f75392b6ebd6e51701eccd8456 Mon Sep 17 00:00:00 2001 From: Christoph Albers Date: Tue, 13 Dec 2016 16:10:58 +0100 Subject: [PATCH] RPC_backend / transport_url workover - removed deprecated rabbitmq attributes - added rabbit_transport_url Change-Id: I19ff8e4df8f559bf03ff746fcc49be9425edd84e Depends-On: I0a6da37e3f2b839590b6349fd906d47c5206fbb3 --- attributes/cinder_conf.rb | 1 - recipes/cinder-common.rb | 9 ++------- spec/cinder_common_spec.rb | 13 ++----------- spec/spec_helper.rb | 3 +++ 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/attributes/cinder_conf.rb b/attributes/cinder_conf.rb index d09457b..12469a2 100644 --- a/attributes/cinder_conf.rb +++ b/attributes/cinder_conf.rb @@ -4,7 +4,6 @@ default['openstack']['block-storage']['conf'].tap do |conf| if node['openstack']['block-storage']['syslog']['use'] conf['DEFAULT']['log_config'] = '/etc/openstack/logging.conf' end - conf['DEFAULT']['rpc_backend'] = node['openstack']['mq']['service_type'] conf['DEFAULT']['auth_strategy'] = 'keystone' conf['DEFAULT']['control_exchange'] = 'cinder' conf['DEFAULT']['volume_group'] = 'cinder-volumes' diff --git a/recipes/cinder-common.rb b/recipes/cinder-common.rb index 7ad85a3..7ac90b3 100644 --- a/recipes/cinder-common.rb +++ b/recipes/cinder-common.rb @@ -41,13 +41,8 @@ if node['openstack']['endpoints']['db']['enabled_slave'] db_uri('block-storage', db_user, db_pass, true) end -unless node['openstack']['block-storage']['conf']['DEFAULT']['rpc_backend'].nil? - user = node['openstack']['mq']['block-storage']['rabbit']['userid'] - node.default['openstack']['block-storage']['conf_secrets'] - .[]('oslo_messaging_rabbit')['rabbit_userid'] = user - node.default['openstack']['block-storage']['conf_secrets'] - .[]('oslo_messaging_rabbit')['rabbit_password'] = - get_password 'user', user +if node['openstack']['mq']['service_type'] == 'rabbit' + node.default['openstack']['block-storage']['conf_secrets']['DEFAULT']['transport_url'] = rabbit_transport_url 'block-storage' end glance_api_endpoint = internal_endpoint 'image_api' diff --git a/spec/cinder_common_spec.rb b/spec/cinder_common_spec.rb index 8e65abf..59a0843 100644 --- a/spec/cinder_common_spec.rb +++ b/spec/cinder_common_spec.rb @@ -192,8 +192,8 @@ describe 'openstack-block-storage::cinder-common' do expect(chef_run).to render_file(file.name).with_content(/^osapi_volume_listen_port = 8776$/) end end - it 'has default RPC/AMQP options set' do - [/^rpc_backend = rabbit/].each do |line| + it 'has default transport_url/AMQP options set' do + [%r{^transport_url = rabbit://guest:mypass@127.0.0.1:5672$}].each do |line| expect(chef_run).to render_file(file.name).with_content(line) end end @@ -216,15 +216,6 @@ describe 'openstack-block-storage::cinder-common' do end end - it 'has rabbit_userid' do - node.set['openstack']['mq']['block-storage']['rabbit']['userid'] = 'rabbit_userid_value' - expect(chef_run).to render_config_file(file.name).with_section_content('oslo_messaging_rabbit', /^rabbit_userid = rabbit_userid_value$/) - end - - it 'has rabbit_password' do - expect(chef_run).to render_config_file(file.name).with_section_content('oslo_messaging_rabbit', /^rabbit_password = #{test_pass}$/) - end - it 'has rabbit_virtual_host' do node.set['openstack']['block-storage']['conf']['oslo_messaging_rabbit']['rabbit_virtual_host'] = 'vhost_value' expect(chef_run).to render_config_file(file.name).with_section_content('oslo_messaging_rabbit', /^rabbit_virtual_host = vhost_value$/) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0876859..1242590 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -58,6 +58,9 @@ shared_context 'block-storage-stubs' do allow_any_instance_of(Chef::Recipe).to receive(:get_password) .with('user', 'ibmnas_admin') .and_return('test_pass') + allow_any_instance_of(Chef::Recipe).to receive(:rabbit_transport_url) + .with('block-storage') + .and_return('rabbit://guest:mypass@127.0.0.1:5672') allow(Chef::Application).to receive(:fatal!) end end