Browse Source

Fix lock_path to be based upon state path

On some recent platforms, systemd based, the /var/lock/ path gets
cleaned up at reboot and causes issues for projects like cinder.
Nova and neutron changed long ago to base the lock path off the
state path, this change does the same thing now for cinder.

Change-Id: Ibe693c21cfc63dd5b6e1753c85081a952005b293
Closes-Bug: #1449711
Mark Vanderwiel 4 years ago
parent
commit
6f44d71631
3 changed files with 13 additions and 8 deletions
  1. 7
    2
      attributes/default.rb
  2. 1
    1
      recipes/cinder-common.rb
  3. 5
    5
      spec/cinder_common_spec.rb

+ 7
- 2
attributes/default.rb View File

@@ -40,8 +40,6 @@ default['openstack']['block-storage']['debug'] = 'False'
40 40
 # Specify policy.json remote file to import
41 41
 default['openstack']['block-storage']['policyfile_url'] = nil
42 42
 
43
-# Default lock_path
44
-default['openstack']['block-storage']['lock_path'] = '/var/lock/cinder'
45 43
 # Default notification_driver and control exchange
46 44
 default['openstack']['block-storage']['notification_driver'] = 'cinder.openstack.common.notifier.rpc_notifier'
47 45
 default['openstack']['block-storage']['control_exchange'] = 'cinder'
@@ -314,6 +312,13 @@ default['openstack']['block-storage']['volume']['default_volume_type'] = nil
314 312
 # For example: ['# Comment', 'key=value']
315 313
 default['openstack']['block-storage']['misc_cinder'] = []
316 314
 
315
+# Default lock_path
316
+# The lock_path normally uses /var/lock/cinder, but it's does not work
317
+# in cases like systemd, so setting lock_path to $state_path/lock like
318
+# in nova and neutron.
319
+default['openstack']['block-storage']['lock_path'] =
320
+  "#{node['openstack']['block-storage']['volume']['state_path']}/lock"
321
+
317 322
 case platform_family
318 323
 when 'fedora', 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this
319 324
   # operating system user and group names

+ 1
- 1
recipes/cinder-common.rb View File

@@ -124,7 +124,7 @@ end
124 124
 directory node['openstack']['block-storage']['lock_path'] do
125 125
   group node['openstack']['block-storage']['group']
126 126
   owner node['openstack']['block-storage']['user']
127
-  mode 00700
127
+  mode 00755
128 128
 end
129 129
 
130 130
 template '/etc/cinder/rootwrap.conf' do

+ 5
- 5
spec/cinder_common_spec.rb View File

@@ -193,7 +193,7 @@ describe 'openstack-block-storage::cinder-common' do
193 193
         end
194 194
 
195 195
         it 'has a lock_path attribute' do
196
-          expect(chef_run).to render_config_file(file.name).with_section_content('oslo_concurrency', %r(^lock_path=/var/lock/cinder$))
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 199
         context 'netapp driver' do
@@ -971,10 +971,10 @@ describe 'openstack-block-storage::cinder-common' do
971 971
       end
972 972
     end
973 973
 
974
-    describe '/var/lock/cinder' do
975
-      let(:dir) { chef_run.directory('/var/lock/cinder') }
974
+    describe '/var/lib/cinder/lock' do
975
+      let(:dir) { chef_run.directory('/var/lib/cinder/lock') }
976 976
 
977
-      it 'should create the /var/lock/cinder directory' do
977
+      it 'should create the /var/lib/cinder/lock directory' do
978 978
         expect(chef_run).to create_directory(dir.name)
979 979
       end
980 980
 
@@ -984,7 +984,7 @@ describe 'openstack-block-storage::cinder-common' do
984 984
       end
985 985
 
986 986
       it 'has proper modes' do
987
-        expect(sprintf('%o', dir.mode)).to eq '700'
987
+        expect(sprintf('%o', dir.mode)).to eq '755'
988 988
       end
989 989
     end
990 990
 

Loading…
Cancel
Save