Browse Source

Add host id to cinder default section

Cinder volumes are associated with the cinder host that created them.
This unique host id can be changed in the conf file. This patch adds
support to allow that.

Change-Id: I9295ed1bfa24bfac8325bd347a92b5e334a31371
Closes-Bug: #1451967
tags/kilo-eol
Mark Vanderwiel 4 years ago
parent
commit
c9f1018d9b
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
@@ -196,6 +196,10 @@ describe 'openstack-block-storage::cinder-common' do
196 196
           expect(chef_run).to render_config_file(file.name).with_section_content('oslo_concurrency', %r(^lock_path=/var/lib/cinder/lock$))
197 197
         end
198 198
 
199
+        it 'does not have unique host id by default' do
200
+          expect(chef_run).not_to render_config_file(file.name).with_section_content('DEFAULT', /^host=/)
201
+        end
202
+
199 203
         context 'netapp driver' do
200 204
           # FIXME(galstrom21): this block needs to check all of the default
201 205
           #   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