From 30d7e3d85a8167bbc03512ee21c13339bd5c2a8c Mon Sep 17 00:00:00 2001 From: Xing Zhou Date: Wed, 21 Dec 2016 13:36:31 +0800 Subject: [PATCH] Add customization for wsgi process display name Change-Id: I08ef3c9c863f3ea9bd4f9170b28b5cc23b416cf0 Related-Bug: #1626550 --- manifests/wsgi/apache.pp | 82 +++++++++++++------------ spec/classes/cinder_wsgi_apache_spec.rb | 25 ++++++-- 2 files changed, 64 insertions(+), 43 deletions(-) diff --git a/manifests/wsgi/apache.pp b/manifests/wsgi/apache.pp index 44e23148..69522928 100644 --- a/manifests/wsgi/apache.pp +++ b/manifests/wsgi/apache.pp @@ -52,6 +52,10 @@ # (optional) The number of threads for the vhost. # Defaults to $::os_workers # +# [*wsgi_process_display_name*] +# (optional) Name of the WSGI process display-name. +# Defaults to undef +# # [*ssl_cert*] # [*ssl_key*] # [*ssl_chain*] @@ -73,21 +77,22 @@ # class { 'cinder::wsgi::apache': } # class cinder::wsgi::apache ( - $servername = $::fqdn, - $port = 8776, - $bind_host = undef, - $path = '/', - $ssl = true, - $workers = 1, - $ssl_cert = undef, - $ssl_key = undef, - $ssl_chain = undef, - $ssl_ca = undef, - $ssl_crl_path = undef, - $ssl_crl = undef, - $ssl_certs_dir = undef, - $threads = $::os_workers, - $priority = '10', + $servername = $::fqdn, + $port = 8776, + $bind_host = undef, + $path = '/', + $ssl = true, + $workers = 1, + $ssl_cert = undef, + $ssl_key = undef, + $ssl_chain = undef, + $ssl_ca = undef, + $ssl_crl_path = undef, + $ssl_crl = undef, + $ssl_certs_dir = undef, + $wsgi_process_display_name = undef, + $threads = $::os_workers, + $priority = '10', ) { include ::cinder::deps @@ -99,28 +104,29 @@ class cinder::wsgi::apache ( } ::openstacklib::wsgi::apache { 'cinder_wsgi': - bind_host => $bind_host, - bind_port => $port, - group => 'cinder', - path => $path, - priority => $priority, - servername => $servername, - ssl => $ssl, - ssl_ca => $ssl_ca, - ssl_cert => $ssl_cert, - ssl_certs_dir => $ssl_certs_dir, - ssl_chain => $ssl_chain, - ssl_crl => $ssl_crl, - ssl_crl_path => $ssl_crl_path, - ssl_key => $ssl_key, - threads => $threads, - user => 'cinder', - workers => $workers, - wsgi_daemon_process => 'cinder-api', - wsgi_process_group => 'cinder-api', - wsgi_script_dir => $::cinder::params::cinder_wsgi_script_path, - wsgi_script_file => 'cinder-api', - wsgi_script_source => $::cinder::params::cinder_wsgi_script_source, - require => Anchor['cinder::install::end'], + bind_host => $bind_host, + bind_port => $port, + group => 'cinder', + path => $path, + priority => $priority, + servername => $servername, + ssl => $ssl, + ssl_ca => $ssl_ca, + ssl_cert => $ssl_cert, + ssl_certs_dir => $ssl_certs_dir, + ssl_chain => $ssl_chain, + ssl_crl => $ssl_crl, + ssl_crl_path => $ssl_crl_path, + ssl_key => $ssl_key, + threads => $threads, + user => 'cinder', + workers => $workers, + wsgi_daemon_process => 'cinder-api', + wsgi_process_display_name => $wsgi_process_display_name, + wsgi_process_group => 'cinder-api', + wsgi_script_dir => $::cinder::params::cinder_wsgi_script_path, + wsgi_script_file => 'cinder-api', + wsgi_script_source => $::cinder::params::cinder_wsgi_script_source, + require => Anchor['cinder::install::end'], } } diff --git a/spec/classes/cinder_wsgi_apache_spec.rb b/spec/classes/cinder_wsgi_apache_spec.rb index a1696aae..1ba9c19b 100644 --- a/spec/classes/cinder_wsgi_apache_spec.rb +++ b/spec/classes/cinder_wsgi_apache_spec.rb @@ -37,6 +37,13 @@ describe 'cinder::wsgi::apache' do 'docroot_group' => 'cinder', 'ssl' => 'true', 'wsgi_daemon_process' => 'cinder-api', + 'wsgi_daemon_process_options' => { + 'user' => 'cinder', + 'group' => 'cinder', + 'processes' => 1, + 'threads' => '42', + 'display-name' => 'cinder_wsgi', + }, 'wsgi_process_group' => 'cinder-api', 'wsgi_script_aliases' => { '/' => "#{platform_params[:wsgi_script_path]}/cinder-api" }, 'require' => 'File[cinder_wsgi]' @@ -47,11 +54,12 @@ describe 'cinder::wsgi::apache' do describe 'when overriding parameters using different ports' do let :params do { - :servername => 'dummy.host', - :bind_host => '10.42.51.1', - :port => 12345, - :ssl => false, - :workers => 37, + :servername => 'dummy.host', + :bind_host => '10.42.51.1', + :port => 12345, + :ssl => false, + :wsgi_process_display_name => 'cinder-api', + :workers => 37, } end @@ -64,6 +72,13 @@ describe 'cinder::wsgi::apache' do 'docroot_group' => 'cinder', 'ssl' => 'false', 'wsgi_daemon_process' => 'cinder-api', + 'wsgi_daemon_process_options' => { + 'user' => 'cinder', + 'group' => 'cinder', + 'processes' => '37', + 'threads' => '42', + 'display-name' => 'cinder-api', + }, 'wsgi_process_group' => 'cinder-api', 'wsgi_script_aliases' => { '/' => "#{platform_params[:wsgi_script_path]}/cinder-api" }, 'require' => 'File[cinder_wsgi]'