Browse Source

Create mount point directory when use multi backend configuration

Currently, when we use GPFSDriver as multi backend volume driver,
cookbook won't create gpfs mount point base directory automatically.

This patch fix this problem.

Closes-Bug: #1476960

Change-Id: I1faf33470747fac6df66854470cf45d35a38f3c1
Lan Qi song 3 years ago
parent
commit
7f980745eb
2 changed files with 37 additions and 0 deletions
  1. 13
    0
      recipes/volume.rb
  2. 24
    0
      spec/volume-redhat_spec.rb

+ 13
- 0
recipes/volume.rb View File

@@ -141,6 +141,19 @@ when 'cinder.volume.drivers.ibm.gpfs.GPFSDriver'
141 141
     group node['openstack']['block-storage']['group']
142 142
     recursive true
143 143
   end
144
+  multi_backend = node['openstack']['block-storage']['volume']['multi_backend']
145
+  unless multi_backend.nil?
146
+    multi_backend.each do |_drv, options|
147
+      options.select { |optkey, _optvalue| optkey == 'gpfs_mount_point_base' }.each do |_optkey, optvalue|
148
+        directory optvalue do
149
+          mode '0755'
150
+          owner node['openstack']['block-storage']['user']
151
+          group node['openstack']['block-storage']['group']
152
+          recursive true
153
+        end
154
+      end
155
+    end
156
+  end
144 157
 
145 158
 when 'cinder.volume.drivers.ibm.ibmnas.IBMNAS_NFSDriver'
146 159
   directory node['openstack']['block-storage']['ibmnas']['mount_point_base'] do

+ 24
- 0
spec/volume-redhat_spec.rb View File

@@ -110,6 +110,17 @@ describe 'openstack-block-storage::volume' do
110 110
         @chef_run = ::ChefSpec::SoloRunner.new ::REDHAT_OPTS do |n|
111 111
           n.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.ibm.gpfs.GPFSDriver'
112 112
           n.set['openstack']['block-storage']['gpfs']['gpfs_mount_point_base'] = 'volumes'
113
+          n.set['openstack']['block-storage']['volume']['multi_backend'] =
114
+          {
115
+            'gpfs01' => {
116
+              'gpfs_mount_point_base' => 'gpfs_volume01',
117
+              'volume_driver' => 'cinder.volume.drivers.ibm.gpfs.GPFSDriver'
118
+            },
119
+            'gpfs02' => {
120
+              'gpfs_mount_point_base' => 'gpfs_volume02',
121
+              'volume_driver' => 'cinder.volume.drivers.ibm.gpfs.GPFSDriver'
122
+            }
123
+          }
113 124
         end
114 125
 
115 126
         @conf = '/etc/cinder/cinder.conf'
@@ -160,6 +171,19 @@ describe 'openstack-block-storage::volume' do
160 171
           mode: '0755'
161 172
         )
162 173
       end
174
+
175
+      it 'verifies mount point base is created in multi backend case' do
176
+        expect(@chef_run).to create_directory('gpfs_volume01').with(
177
+          owner: 'cinder',
178
+          group: 'cinder',
179
+          mode: '0755'
180
+        )
181
+        expect(@chef_run).to create_directory('gpfs_volume02').with(
182
+          owner: 'cinder',
183
+          group: 'cinder',
184
+          mode: '0755'
185
+        )
186
+      end
163 187
     end
164 188
 
165 189
     describe 'create_vg' do

Loading…
Cancel
Save