From 4ab30d3bc60c29c2d489c8b9a61b9080f1f6c829 Mon Sep 17 00:00:00 2001 From: Alan Bishop Date: Fri, 1 Jul 2022 10:42:00 -0700 Subject: [PATCH] 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 6f61ecd9c5b030817d0255fd8fd485722f9556f4) (cherry picked from commit ba4ada0c70b31277b8569b71d40692b17c2a632b) (cherry picked from commit 1d37e5400aa1731e28a39ee9bfcbb84173d0690a) --- manifests/api.pp | 10 ++++++++ manifests/params.pp | 2 ++ ...oncurrency-lock_path-666f5836ec062c5a.yaml | 13 ++++++++++ spec/classes/glance_api_spec.rb | 25 +++++++++++++++++++ 4 files changed, 50 insertions(+) create mode 100644 releasenotes/notes/add-concurrency-lock_path-666f5836ec062c5a.yaml diff --git a/manifests/api.pp b/manifests/api.pp index 5b697235..397c70a5 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -244,6 +244,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*] @@ -352,6 +357,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, @@ -599,6 +605,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 b3e2d89b..a3345229 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -16,6 +16,7 @@ class glance::params { $api_package_name = undef $api_service_name = 'openstack-glance-api' $pyceph_package_name = "python${pyvers}-rbd" + $lock_path = '/var/lib/glance/tmp' } 'Debian': { $package_name = undef @@ -26,6 +27,7 @@ class glance::params { } else { $pyceph_package_name = "python${pyvers}-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 7adb7717..5c206bac 100644 --- a/spec/classes/glance_api_spec.rb +++ b/spec/classes/glance_api_spec.rb @@ -265,6 +265,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 }) @@ -543,6 +559,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