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
This commit is contained in:
ZhongShengping 2019-07-04 11:34:43 +08:00
parent 009b9c77c2
commit 9fb1805e1b
3 changed files with 24 additions and 0 deletions

View File

@ -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' {

View File

@ -0,0 +1,5 @@
---
features:
- |
Add support to configure `[oslo_middleware]/max_request_body_size` with
`$max_request_body_size`.

View File

@ -32,6 +32,7 @@ describe 'manila::api' do
is_expected.to contain_manila_config('DEFAULT/enabled_share_protocols').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_oslo__middleware('manila_config').with(
:enable_proxy_headers_parsing => '<SERVICE DEFAULT>',
:max_request_body_size => '<SERVICE DEFAULT>',
)
is_expected.to contain_manila_config('DEFAULT/default_share_type').with(:value => '<SERVICE DEFAULT>')
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})