Add more settings to glance-api

Settings added:
- limit_param_default, The default number of results to return
  for a request.
- api_limit_max, Maximum number of results that could be returned
  by a request.

Change-Id: I5362e2b15531df1d2160b67ce2b572c64b1b0989
Co-Authored-By: Alex Schultz <aschultz@redhat.com>
(cherry picked from commit ebbac230d1)
This commit is contained in:
Saverio Proto 2016-12-06 11:01:25 +01:00 committed by Daniel Pawlik
parent 076c4c62cd
commit 6b791c91d1
3 changed files with 24 additions and 0 deletions

View File

@ -262,6 +262,15 @@
# try_sleep: 10
# Defaults to {}
#
# [*limit_param_default*]
# (optional) Default value for the number of items returned by a request if not
# specified explicitly in the request (integer value)
# Default: $::os_service_default.
#
# [*api_limit_max*]
# (optional) Maximum number of results that could be returned by a request
# Default: $::os_service_default.
#
# === deprecated parameters:
#
# [*known_stores*]
@ -328,6 +337,8 @@ class glance::api(
$sync_db = true,
$validate = false,
$validation_options = {},
$limit_param_default = $::os_service_default,
$api_limit_max = $::os_service_default,
# DEPRECATED PARAMETERS
$known_stores = false,
) inherits glance {
@ -366,6 +377,8 @@ class glance::api(
'DEFAULT/image_cache_dir': value => $image_cache_dir;
'DEFAULT/enable_v1_api': value => $enable_v1_api;
'DEFAULT/enable_v2_api': value => $enable_v2_api;
'DEFAULT/limit_param_default': value => $limit_param_default;
'DEFAULT/api_limit_max': value => $api_limit_max;
'glance_store/os_region_name': value => $os_region_name;
}

View File

@ -0,0 +1,5 @@
---
features:
- |
Added the ability to manage the 'limit_param_default' and 'api_limit_max'
options for the glance api.

View File

@ -45,6 +45,8 @@ describe 'glance::api' do
:enable_v1_api => '<SERVICE DEFAULT>',
:enable_v2_api => '<SERVICE DEFAULT>',
:sync_db => true,
:limit_param_default => '<SERVICE DEFAULT>',
:api_limit_max => '<SERVICE DEFAULT>',
}
end
@ -72,6 +74,8 @@ describe 'glance::api' do
:os_region_name => 'RegionOne2',
:pipeline => 'keystone2',
:sync_db => false,
:limit_param_default => '10',
:api_limit_max => '10',
}
].each do |param_set|
@ -124,6 +128,8 @@ describe 'glance::api' do
'image_cache_dir',
'enable_v1_api',
'enable_v2_api',
'limit_param_default',
'api_limit_max',
].each do |config|
is_expected.to contain_glance_api_config("DEFAULT/#{config}").with_value(param_hash[config.intern])
end