Browse Source

Make enable v1 and v2 api option configurable

Change-Id: I40efdc8c31dc38f214cc300cc68279af1b614089
Closes-Bug: #1452730
tags/kilo-eol
Lan Qi song 4 years ago
parent
commit
2ea252646d
4 changed files with 21 additions and 4 deletions
  1. 2
    0
      README.md
  2. 6
    0
      attributes/default.rb
  3. 11
    2
      spec/cinder_common_spec.rb
  4. 2
    2
      templates/default/cinder.conf.erb

+ 2
- 0
README.md View File

@@ -142,6 +142,8 @@ Cinder attributes
142 142
 * `openstack["block-storage"]["rpc_conn_pool_size"]` - Size of RPC connection pool
143 143
 * `openstack["block-storage"]["rpc_response_timeout"]` - Seconds to wait for a response from call or multicall
144 144
 * `openstack["block-storage"]["misc_cinder"] - Array of strings to be added to cinder.conf for misc options, e.g. ['# Comment', 'key=value']
145
+* `openstack["block-storage"]["enable_v1_api"]` - Whether to enable cinder v1 api or not.
146
+* `openstack["block-storage"]["enable_v2_api"]` - Whether to enable cinder v2 api or not.
145 147
 
146 148
 ### Storwize/SVC attributes ###
147 149
 * `openstack['block-storage']['san']['san_ip'] - IP address of SAN controller

+ 6
- 0
attributes/default.rb View File

@@ -322,6 +322,12 @@ default['openstack']['block-storage']['misc_cinder'] = []
322 322
 default['openstack']['block-storage']['lock_path'] =
323 323
   "#{node['openstack']['block-storage']['volume']['state_path']}/lock"
324 324
 
325
+# Whether to enable cinder v1 api or not
326
+default['openstack']['block-storage']['enable_v1_api'] = 'False'
327
+
328
+# Whether to enable cinder v2 api or not
329
+default['openstack']['block-storage']['enable_v2_api'] = 'True'
330
+
325 331
 case platform_family
326 332
 when 'fedora', 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this
327 333
   # operating system user and group names

+ 11
- 2
spec/cinder_common_spec.rb View File

@@ -341,8 +341,17 @@ describe 'openstack-block-storage::cinder-common' do
341 341
           end
342 342
 
343 343
           it 'has default api version set' do
344
-            [/^enable_v1_api=false$/,
345
-             /^enable_v2_api=true$/].each do |line|
344
+            [/^enable_v1_api=False$/,
345
+             /^enable_v2_api=True$/].each do |line|
346
+              expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', line)
347
+            end
348
+          end
349
+
350
+          it 'has override api version set' do
351
+            node.set['openstack']['block-storage']['enable_v1_api'] = 'True'
352
+            node.set['openstack']['block-storage']['enable_v2_api'] = 'False'
353
+            [/^enable_v1_api=True$/,
354
+             /^enable_v2_api=False$/].each do |line|
346 355
               expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', line)
347 356
             end
348 357
           end

+ 2
- 2
templates/default/cinder.conf.erb View File

@@ -53,10 +53,10 @@ log_file = /var/log/cinder/cinder.log
53 53
 #### (StrOpt) File name for the paste.deploy config for cinder-api
54 54
 
55 55
 # DEPRECATED: Deploy v1 of the Cinder API. (boolean value)
56
-enable_v1_api=false
56
+enable_v1_api=<%= node["openstack"]["block-storage"]["enable_v1_api"] %>
57 57
 
58 58
 # Deploy v2 of the Cinder API. (boolean value)
59
-enable_v2_api=true
59
+enable_v2_api=<%= node["openstack"]["block-storage"]["enable_v2_api"] %>
60 60
 
61 61
 # pybasedir=/usr/lib/python/site-packages
62 62
 #### (StrOpt) Directory where the cinder python module is installed

Loading…
Cancel
Save