Configure the oslo.concurrency lock_path

A recent change in os-brick [1], which is used by cinder backends,
requires external file locks. This patch adds support for configuring
the lock path, with a default value that matches the corresponding
lock paths used by other services that use os-brick (namely cinder
and nova).

[1] I6f7f7d19540361204d4ae3ead2bd6dcddb8fcd68

Closes-Bug: #1980539
Change-Id: I5ea6766656f4227a1c514777c03bbf78d4ac59cd
(cherry picked from commit 6f61ecd9c5)
(cherry picked from commit ba4ada0c70)
(cherry picked from commit 1d37e5400a)
(cherry picked from commit 4ab30d3bc6)
(cherry picked from commit 8ce29aa7c5)
This commit is contained in:
Alan Bishop 2022-07-01 10:42:00 -07:00
parent 7acc7fb7e4
commit b3964a75ba
4 changed files with 50 additions and 0 deletions

View File

@ -278,6 +278,11 @@
# http://auth_url:5000/v3
# Defaults to undef
#
# [*lock_path*]
# (optional) Where to store lock files. This directory must be writeable
# by the user executing the agent
# Defaults to: $::glance::params::lock_path
#
# DEPRECATED PARAMETERS
#
# [*stores*]
@ -380,6 +385,7 @@ class glance::api(
$keymgr_backend = undef,
$keymgr_encryption_api_url = undef,
$keymgr_encryption_auth_url = undef,
$lock_path = $::glance::params::lock_path,
# DEPRECATED PARAMETERS
$stores = undef,
$default_store = undef,
@ -630,6 +636,10 @@ enabled_backends instead.')
include glance::api::authtoken
}
oslo::concurrency { 'glance_api_config':
lock_path => $lock_path,
}
oslo::middleware { 'glance_api_config':
enable_proxy_headers_parsing => $enable_proxy_headers_parsing,
max_request_body_size => $max_request_body_size,

View File

@ -17,6 +17,7 @@ class glance::params {
$api_service_name = 'openstack-glance-api'
$registry_service_name = 'openstack-glance-registry'
$pyceph_package_name = "python${pyvers}-rbd"
$lock_path = '/var/lib/glance/tmp'
}
'Debian': {
$api_package_name = 'glance-api'
@ -28,6 +29,7 @@ class glance::params {
} else {
$pyceph_package_name = "python${pyvers}-rbd"
}
$lock_path = '/var/lock/glance'
}
default: {
fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, \

View File

@ -0,0 +1,13 @@
---
upgrade:
- |
The ``glance::api`` class now supports a ``lock_path`` parameter that
configures the oslo.concurrency lock_path with a platform specific
default value. Distributions that are used to defining the lock_path
with a distribution specific config file may need to override the
default ``glance::api::lock_path`` value.
fixes:
- |
`Bug #1980539 <https://bugs.launchpad.net/puppet-glance/+bug/1980539>`_:
Configure the oslo.concurrency lock_path, which is now required by cinder
backends.

View File

@ -268,6 +268,22 @@ describe 'glance::api' do
end
end
describe 'with platform default oslo concurrency lock_path' do
it { is_expected.to contain_oslo__concurrency('glance_api_config').with(
:lock_path => platform_params[:lock_path]
)}
end
describe 'with overridden oslo concurrency lock_path' do
let :params do
{:lock_path => '/glance/lock/path' }
end
it { is_expected.to contain_oslo__concurrency('glance_api_config').with(
:lock_path => '/glance/lock/path',
)}
end
describe 'setting enable_proxy_headers_parsing' do
let :params do
default_params.merge({:enable_proxy_headers_parsing => true })
@ -524,6 +540,15 @@ describe 'glance::api' do
facts.merge!(OSDefaults.get_facts())
end
let(:platform_params) do
case facts[:osfamily]
when 'Debian'
{ :lock_path => '/var/lock/glance' }
when 'RedHat'
{ :lock_path => '/var/lib/glance/tmp' }
end
end
it_configures 'glance::api'
it_configures "glance::api #{facts[:osfamily]}"
end