Debian: uwsgi/threads with 1 as default

We should not tweak the number of threads, nova-api is only
mono-threaded and will currently refuse to work with anything
else than 1.

So this patch sets 1 by default, and warns if wsgi::uwsgi is
called with something else.

Change-Id: Ib109175b2e1a9f9f6b96355d29f9f9a95c303957
This commit is contained in:
Thomas Goirand
2021-04-19 19:00:33 +02:00
parent 1599c882d5
commit f7be71fd20
5 changed files with 16 additions and 7 deletions

View File

@@ -15,7 +15,7 @@
# #
# [*threads*] # [*threads*]
# (Optional) Number of threads. # (Optional) Number of threads.
# Defaults to 32. # Defaults to 1.
# #
# [*listen_queue_size*] # [*listen_queue_size*]
# (Optional) Socket listen queue size. # (Optional) Socket listen queue size.
@@ -23,7 +23,7 @@
# #
class nova::wsgi::uwsgi_api ( class nova::wsgi::uwsgi_api (
$processes = $::os_workers, $processes = $::os_workers,
$threads = 32, $threads = 1,
$listen_queue_size = 100, $listen_queue_size = 100,
){ ){
@@ -33,6 +33,10 @@ class nova::wsgi::uwsgi_api (
warning('This class is only valid for Debian, as other operating systems are not using uwsgi by default.') warning('This class is only valid for Debian, as other operating systems are not using uwsgi by default.')
} }
if $threads != 1 {
warning('The nova API currently does not support anything else than threads=1.')
}
nova_api_uwsgi_config { nova_api_uwsgi_config {
'uwsgi/processes': value => $processes; 'uwsgi/processes': value => $processes;
'uwsgi/threads': value => $threads; 'uwsgi/threads': value => $threads;

View File

@@ -23,7 +23,7 @@
# #
class nova::wsgi::uwsgi_api_metadata ( class nova::wsgi::uwsgi_api_metadata (
$processes = $::os_workers, $processes = $::os_workers,
$threads = 32, $threads = 1,
$listen_queue_size = 100, $listen_queue_size = 100,
){ ){
@@ -33,6 +33,10 @@ class nova::wsgi::uwsgi_api_metadata (
warning('This class is only valid for Debian, as other operating systems are not using uwsgi by default.') warning('This class is only valid for Debian, as other operating systems are not using uwsgi by default.')
} }
if $threads != 1 {
warning('The nova API currently does not support anything else than threads=1.')
}
nova_api_metadata_uwsgi_config { nova_api_metadata_uwsgi_config {
'uwsgi/processes': value => $processes; 'uwsgi/processes': value => $processes;
'uwsgi/threads': value => $threads; 'uwsgi/threads': value => $threads;

View File

@@ -4,5 +4,6 @@ features:
Two new calsses nova::wsgi::wsgi_api and nova::wsgi::wsgi_api_metadata Two new calsses nova::wsgi::wsgi_api and nova::wsgi::wsgi_api_metadata
exist to allow configuring uwsgi in operating systems that support this exist to allow configuring uwsgi in operating systems that support this
(ie: currently Debian). This helps configuring the number of processes, (ie: currently Debian). This helps configuring the number of processes,
threads and listen socket. Also, two new nova_api_uwsgi_config and threads, and listen socket. Please note that currently, nova does not
nova_api_metadata_uwsgi_config provider now exist. support anything else than threads=1. Also, two new nova_api_uwsgi_config
and nova_api_metadata_uwsgi_config provider now exist.

View File

@@ -10,7 +10,7 @@ describe 'nova::wsgi::uwsgi_api_metadata' do
it { it {
is_expected.to contain_nova_api_metadata_uwsgi_config('uwsgi/processes').with_value(facts[:os_workers]) is_expected.to contain_nova_api_metadata_uwsgi_config('uwsgi/processes').with_value(facts[:os_workers])
is_expected.to contain_nova_api_metadata_uwsgi_config('uwsgi/threads').with_value('32') is_expected.to contain_nova_api_metadata_uwsgi_config('uwsgi/threads').with_value('1')
is_expected.to contain_nova_api_metadata_uwsgi_config('uwsgi/listen').with_value('100') is_expected.to contain_nova_api_metadata_uwsgi_config('uwsgi/listen').with_value('100')
} }
end end

View File

@@ -10,7 +10,7 @@ describe 'nova::wsgi::uwsgi_api' do
it { it {
is_expected.to contain_nova_api_uwsgi_config('uwsgi/processes').with_value(facts[:os_workers]) is_expected.to contain_nova_api_uwsgi_config('uwsgi/processes').with_value(facts[:os_workers])
is_expected.to contain_nova_api_uwsgi_config('uwsgi/threads').with_value('32') is_expected.to contain_nova_api_uwsgi_config('uwsgi/threads').with_value('1')
is_expected.to contain_nova_api_uwsgi_config('uwsgi/listen').with_value('100') is_expected.to contain_nova_api_uwsgi_config('uwsgi/listen').with_value('100')
} }
end end