Support [queue] asynchronous_workers option

... which determines number of processes launched in barbican-worker.

Change-Id: Ia31a7d440ba3102afa7b5972fe893cfb4f1817a1
This commit is contained in:
Takashi Kajinami 2024-02-15 00:01:24 +09:00
parent 4947050bc7
commit b234e97fea
3 changed files with 28 additions and 10 deletions

View File

@ -33,10 +33,15 @@
# (Optional) Whether to enable the barbican-worker service.
# Defaults to true
#
# [*workers*]
# (Optional) Number of asynchronous worker process.
# Defaults to $facts['os_service_default']
#
class barbican::worker (
$package_ensure = 'present',
Boolean $manage_service = true,
Boolean $enabled = true,
$workers = $facts['os_service_default'],
) inherits barbican::params {
include barbican::deps
@ -47,6 +52,10 @@ class barbican::worker (
tag => ['openstack', 'barbican-package'],
}
barbican_config {
'queue/asynchronous_workers': value => $workers;
}
if $manage_service {
if $enabled {
$service_ensure = 'running'

View File

@ -0,0 +1,4 @@
---
features:
- |
The new ``barbican::worker::workers`` parameter has been added.

View File

@ -19,10 +19,6 @@
require 'spec_helper'
describe 'barbican::worker' do
let :params do
{}
end
shared_examples 'barbican::worker' do
context 'with default parameters' do
it { should contain_package('barbican-worker').with(
@ -31,6 +27,8 @@ describe 'barbican::worker' do
:tag => ['openstack', 'barbican-package']
)}
it { should contain_barbican_config('queue/asynchronous_workers').with_value('<SERVICE DEFAULT>') }
it { should contain_service('barbican-worker').with(
:ensure => 'running',
:name => platform_params[:worker_service_name],
@ -41,17 +39,24 @@ describe 'barbican::worker' do
)}
end
context 'with parameters' do
let :params do
{ :workers => 2 }
end
it { should contain_barbican_config('queue/asynchronous_workers').with_value(2) }
end
context 'with package_ensure set to absent' do
before do
params.merge!( :package_ensure => 'absent' )
let :params do
{ :package_ensure => 'absent' }
end
it { should contain_package('barbican-worker').with_ensure('absent') }
end
context 'with manage_service set to false' do
before do
params.merge!( :manage_service => false )
let :params do
{ :manage_service => false }
end
it { should contain_package('barbican-worker').with_ensure('present') }
@ -59,8 +64,8 @@ describe 'barbican::worker' do
end
context 'with enabled set to false' do
before do
params.merge!( :enabled => false )
let :params do
{ :enabled => false }
end
it { should contain_package('barbican-worker').with_ensure('present') }