Browse Source

RPC_backend / transport_url workover

- removed deprecated rabbitmq attributes
- added rabbit_transport_url

Change-Id: I19ff8e4df8f559bf03ff746fcc49be9425edd84e
Depends-On: I0a6da37e3f2b839590b6349fd906d47c5206fbb3
Christoph Albers 2 years ago
parent
commit
68da464eae
4 changed files with 7 additions and 19 deletions
  1. 0
    1
      attributes/cinder_conf.rb
  2. 2
    7
      recipes/cinder-common.rb
  3. 2
    11
      spec/cinder_common_spec.rb
  4. 3
    0
      spec/spec_helper.rb

+ 0
- 1
attributes/cinder_conf.rb View File

@@ -4,7 +4,6 @@ default['openstack']['block-storage']['conf'].tap do |conf|
4 4
   if node['openstack']['block-storage']['syslog']['use']
5 5
     conf['DEFAULT']['log_config'] = '/etc/openstack/logging.conf'
6 6
   end
7
-  conf['DEFAULT']['rpc_backend'] = node['openstack']['mq']['service_type']
8 7
   conf['DEFAULT']['auth_strategy'] = 'keystone'
9 8
   conf['DEFAULT']['control_exchange'] = 'cinder'
10 9
   conf['DEFAULT']['volume_group'] = 'cinder-volumes'

+ 2
- 7
recipes/cinder-common.rb View File

@@ -41,13 +41,8 @@ if node['openstack']['endpoints']['db']['enabled_slave']
41 41
     db_uri('block-storage', db_user, db_pass, true)
42 42
 end
43 43
 
44
-unless node['openstack']['block-storage']['conf']['DEFAULT']['rpc_backend'].nil?
45
-  user = node['openstack']['mq']['block-storage']['rabbit']['userid']
46
-  node.default['openstack']['block-storage']['conf_secrets']
47
-    .[]('oslo_messaging_rabbit')['rabbit_userid'] = user
48
-  node.default['openstack']['block-storage']['conf_secrets']
49
-    .[]('oslo_messaging_rabbit')['rabbit_password'] =
50
-    get_password 'user', user
44
+if node['openstack']['mq']['service_type'] == 'rabbit'
45
+  node.default['openstack']['block-storage']['conf_secrets']['DEFAULT']['transport_url'] = rabbit_transport_url 'block-storage'
51 46
 end
52 47
 
53 48
 glance_api_endpoint = internal_endpoint 'image_api'

+ 2
- 11
spec/cinder_common_spec.rb View File

@@ -192,8 +192,8 @@ describe 'openstack-block-storage::cinder-common' do
192 192
             expect(chef_run).to render_file(file.name).with_content(/^osapi_volume_listen_port = 8776$/)
193 193
           end
194 194
         end
195
-        it 'has default RPC/AMQP options set' do
196
-          [/^rpc_backend = rabbit/].each do |line|
195
+        it 'has default transport_url/AMQP options set' do
196
+          [%r{^transport_url = rabbit://guest:mypass@127.0.0.1:5672$}].each do |line|
197 197
             expect(chef_run).to render_file(file.name).with_content(line)
198 198
           end
199 199
         end
@@ -216,15 +216,6 @@ describe 'openstack-block-storage::cinder-common' do
216 216
             end
217 217
           end
218 218
 
219
-          it 'has rabbit_userid' do
220
-            node.set['openstack']['mq']['block-storage']['rabbit']['userid'] = 'rabbit_userid_value'
221
-            expect(chef_run).to render_config_file(file.name).with_section_content('oslo_messaging_rabbit', /^rabbit_userid = rabbit_userid_value$/)
222
-          end
223
-
224
-          it 'has rabbit_password' do
225
-            expect(chef_run).to render_config_file(file.name).with_section_content('oslo_messaging_rabbit', /^rabbit_password = #{test_pass}$/)
226
-          end
227
-
228 219
           it 'has rabbit_virtual_host' do
229 220
             node.set['openstack']['block-storage']['conf']['oslo_messaging_rabbit']['rabbit_virtual_host'] = 'vhost_value'
230 221
             expect(chef_run).to render_config_file(file.name).with_section_content('oslo_messaging_rabbit', /^rabbit_virtual_host = vhost_value$/)

+ 3
- 0
spec/spec_helper.rb View File

@@ -58,6 +58,9 @@ shared_context 'block-storage-stubs' do
58 58
     allow_any_instance_of(Chef::Recipe).to receive(:get_password)
59 59
       .with('user', 'ibmnas_admin')
60 60
       .and_return('test_pass')
61
+    allow_any_instance_of(Chef::Recipe).to receive(:rabbit_transport_url)
62
+      .with('block-storage')
63
+      .and_return('rabbit://guest:mypass@127.0.0.1:5672')
61 64
     allow(Chef::Application).to receive(:fatal!)
62 65
   end
63 66
 end

Loading…
Cancel
Save