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
This commit is contained in:
Mark Vanderwiel 2015-04-28 14:18:52 -05:00
parent 226d27a12d
commit 6f44d71631
3 changed files with 13 additions and 8 deletions

View File

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

View File

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

View File

@ -193,7 +193,7 @@ describe 'openstack-block-storage::cinder-common' do
end
it 'has a lock_path attribute' do
expect(chef_run).to render_config_file(file.name).with_section_content('oslo_concurrency', %r(^lock_path=/var/lock/cinder$))
expect(chef_run).to render_config_file(file.name).with_section_content('oslo_concurrency', %r(^lock_path=/var/lib/cinder/lock$))
end
context 'netapp driver' do
@ -971,10 +971,10 @@ describe 'openstack-block-storage::cinder-common' do
end
end
describe '/var/lock/cinder' do
let(:dir) { chef_run.directory('/var/lock/cinder') }
describe '/var/lib/cinder/lock' do
let(:dir) { chef_run.directory('/var/lib/cinder/lock') }
it 'should create the /var/lock/cinder directory' do
it 'should create the /var/lib/cinder/lock directory' do
expect(chef_run).to create_directory(dir.name)
end
@ -984,7 +984,7 @@ describe 'openstack-block-storage::cinder-common' do
end
it 'has proper modes' do
expect(sprintf('%o', dir.mode)).to eq '700'
expect(sprintf('%o', dir.mode)).to eq '755'
end
end