Browse Source

Merge "Add host id to cinder default section"

Jenkins 4 years ago
parent
commit
6a8e987f42
3 changed files with 13 additions and 3 deletions
  1. 4
    0
      attributes/default.rb
  2. 6
    2
      spec/cinder_common_spec.rb
  3. 3
    1
      templates/default/cinder.conf.erb

+ 4
- 0
attributes/default.rb View File

@@ -37,6 +37,10 @@ default['openstack']['block-storage']['custom_template_banner'] = '
37 37
 default['openstack']['block-storage']['verbose'] = 'False'
38 38
 default['openstack']['block-storage']['debug'] = 'False'
39 39
 
40
+# Name of this node.  This can be an opaque identifier.  It is
41
+# not necessarily a hostname, FQDN, or IP address. (StrOpt)
42
+default['openstack']['block-storage']['host'] = nil
43
+
40 44
 # Specify policy.json remote file to import
41 45
 default['openstack']['block-storage']['policyfile_url'] = nil
42 46
 

+ 6
- 2
spec/cinder_common_spec.rb View File

@@ -167,7 +167,7 @@ describe 'openstack-block-storage::cinder-common' do
167 167
       context 'template contents' do
168 168
 
169 169
         context 'commonly named attributes' do
170
-          %w(debug verbose notification_driver
170
+          %w(debug verbose host notification_driver
171 171
              storage_availability_zone quota_volumes quota_gigabytes quota_driver
172 172
              volume_name_template snapshot_name_template osapi_volume_workers
173 173
              use_default_quota_class quota_snapshots no_snapshot_gb_quota
@@ -175,7 +175,7 @@ describe 'openstack-block-storage::cinder-common' do
175 175
             it "has a #{attr_key} attribute" do
176 176
               node.set['openstack']['block-storage'][attr_key] = "#{attr_key}_value"
177 177
 
178
-              expect(chef_run).to render_file(file.name).with_content(/^#{attr_key}=#{attr_key}_value$/)
178
+              expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', /^#{attr_key}=#{attr_key}_value$/)
179 179
             end
180 180
           end
181 181
         end
@@ -240,6 +240,10 @@ describe 'openstack-block-storage::cinder-common' do
240 240
           expect(chef_run).to render_config_file(file.name).with_section_content('oslo_concurrency', %r(^lock_path=/var/lib/cinder/lock$))
241 241
         end
242 242
 
243
+        it 'does not have unique host id by default' do
244
+          expect(chef_run).not_to render_config_file(file.name).with_section_content('DEFAULT', /^host=/)
245
+        end
246
+
243 247
         context 'netapp driver' do
244 248
           # FIXME(galstrom21): this block needs to check all of the default
245 249
           #   netapp_* configuration options

+ 3
- 1
templates/default/cinder.conf.erb View File

@@ -139,7 +139,9 @@ api_rate_limit=<%= node["openstack"]["block-storage"]["api"]["ratelimit"] %>
139 139
 # scheduler_manager=cinder.scheduler.manager.SchedulerManager
140 140
 #### (StrOpt) full class name for the Manager for scheduler
141 141
 
142
-# host=cinder
142
+<% if node['openstack']['block-storage']['host'] -%>
143
+host=<%= node['openstack']['block-storage']['host'] %>
144
+<% end -%>
143 145
 #### (StrOpt) Name of this node.  This can be an opaque identifier.  It is
144 146
 ####          not necessarily a hostname, FQDN, or IP address.
145 147
 

Loading…
Cancel
Save