diff --git a/manifests/api.pp b/manifests/api.pp index fb34eb6b..e9d4dc37 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -208,6 +208,11 @@ # (optional) Maximum number of results that could be returned by a request # Default: $::os_service_default. # +# [*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*] @@ -336,6 +341,7 @@ class glance::api( $sync_db = true, $limit_param_default = $::os_service_default, $api_limit_max = $::os_service_default, + $lock_path = $::glance::params::lock_path, # DEPRECATED PARAMETERS $stores = undef, $default_store = undef, @@ -590,6 +596,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, diff --git a/manifests/params.pp b/manifests/params.pp index 95030148..34aa99ef 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -17,6 +17,7 @@ class glance::params { $api_package_name = undef $api_service_name = 'openstack-glance-api' $pyceph_package_name = 'python3-rbd' + $lock_path = '/var/lib/glance/tmp' } 'Debian': { $package_name = undef @@ -27,6 +28,7 @@ class glance::params { } else { $pyceph_package_name = 'python3-rbd' } + $lock_path = '/var/lock/glance' } default: { fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, \ diff --git a/releasenotes/notes/add-concurrency-lock_path-666f5836ec062c5a.yaml b/releasenotes/notes/add-concurrency-lock_path-666f5836ec062c5a.yaml new file mode 100644 index 00000000..17d3f1c2 --- /dev/null +++ b/releasenotes/notes/add-concurrency-lock_path-666f5836ec062c5a.yaml @@ -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 `_: + Configure the oslo.concurrency lock_path, which is now required by cinder + backends. diff --git a/spec/classes/glance_api_spec.rb b/spec/classes/glance_api_spec.rb index bfe91f20..40d81328 100644 --- a/spec/classes/glance_api_spec.rb +++ b/spec/classes/glance_api_spec.rb @@ -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 }) @@ -495,6 +511,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' if facts[:osfamily] == 'Debian' it_configures "glance::api on #{facts[:osfamily]}"