From 9fb1805e1b16e44bfa9402eaaf22aba2a4449bde Mon Sep 17 00:00:00 2001 From: ZhongShengping Date: Thu, 4 Jul 2019 11:34:43 +0800 Subject: [PATCH] Manage oslo_middleware/max_request_body_size So that we can increase it from the default 114688 Useful in case for example the OS-Federation mapping is too large. If this limit is breached manila will return a 413 Entity Too Large and not log anything to manila.log. Change-Id: I69a790df4774fa4010c356033b8a8167569321c1 Closes-Bug: #1835161 --- manifests/api.pp | 6 ++++++ .../max_request_body_size-b3b7e87591bd6711.yaml | 5 +++++ spec/classes/manila_api_spec.rb | 13 +++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 releasenotes/notes/max_request_body_size-b3b7e87591bd6711.yaml diff --git a/manifests/api.pp b/manifests/api.pp index 7ff2ea7d..5776e618 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -55,6 +55,10 @@ # HTTPProxyToWSGI middleware. # Defaults to $::os_service_default. # +# [*max_request_body_size*] +# (Optional) Set max request body size +# Defaults to $::os_service_default. +# # [*enabled_share_protocols*] # (optional) Defines the enabled share protocols provided by Manila. # Defaults to $::os_service_default @@ -87,6 +91,7 @@ class manila::api ( $ratelimits = undef, $ratelimits_factory = 'manila.api.v1.limits:RateLimitingMiddleware.factory', $enable_proxy_headers_parsing = $::os_service_default, + $max_request_body_size = $::os_service_default, $enabled_share_protocols = $::os_service_default, $service_workers = $::os_workers, # Deprecated @@ -165,6 +170,7 @@ server.") oslo::middleware { 'manila_config': enable_proxy_headers_parsing => $enable_proxy_headers_parsing, + max_request_body_size => $max_request_body_size, } if $auth_strategy == 'keystone' { diff --git a/releasenotes/notes/max_request_body_size-b3b7e87591bd6711.yaml b/releasenotes/notes/max_request_body_size-b3b7e87591bd6711.yaml new file mode 100644 index 00000000..f29fec52 --- /dev/null +++ b/releasenotes/notes/max_request_body_size-b3b7e87591bd6711.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Add support to configure `[oslo_middleware]/max_request_body_size` with + `$max_request_body_size`. diff --git a/spec/classes/manila_api_spec.rb b/spec/classes/manila_api_spec.rb index 9c76a077..60132979 100644 --- a/spec/classes/manila_api_spec.rb +++ b/spec/classes/manila_api_spec.rb @@ -32,6 +32,7 @@ describe 'manila::api' do is_expected.to contain_manila_config('DEFAULT/enabled_share_protocols').with(:value => '') is_expected.to contain_oslo__middleware('manila_config').with( :enable_proxy_headers_parsing => '', + :max_request_body_size => '', ) is_expected.to contain_manila_config('DEFAULT/default_share_type').with(:value => '') is_expected.to contain_manila_config('DEFAULT/osapi_share_workers').with(:value => '2') @@ -90,6 +91,18 @@ describe 'manila::api' do end end + context 'with only required params' do + let :params do + req_params.merge({'max_request_body_size' => '102400'}) + end + it { is_expected.to contain_class('manila::policy') } + it 'should configure manila api correctly' do + is_expected.to contain_oslo__middleware('manila_config').with( + :max_request_body_size => '102400', + ) + end + end + context 'with enabled false' do let :params do req_params.merge({'enabled' => false})