From 2e707d8ba12a7299f879b4f411bdcea5ae2e5d90 Mon Sep 17 00:00:00 2001 From: Saverio Proto Date: Thu, 24 Mar 2016 08:44:57 +0100 Subject: [PATCH] Add osapi_max_limit parameter osapi_max_limit makes tunable the number of objects returned by a single API call. This is useful in large installations where tenants are likely to have more than 1000 snapshots. backup scripts that rely on: existing_snapshots = cinder.volume_snapshots.list(search_opts=opts) may have false negatives because the result is truncated to the default value of 1000 items. Change-Id: Id16eadb5d71d1d313399e638be948d79190bde6a --- manifests/api.pp | 7 +++++++ spec/classes/cinder_api_spec.rb | 14 ++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/manifests/api.pp b/manifests/api.pp index ad2b3fc7..776d8015 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -136,6 +136,11 @@ # (Optional) Base URL that will be presented to users in links to the OpenStack Volume API. # Defaults to $::os_service_default # +# [*osapi_max_limit*] +# (Optional) The maximum number of items that a collection resource +# returns in a single response (integer value) +# Defaults to $::os_service_default +# class cinder::api ( $keystone_password, $keystone_enabled = true, @@ -165,6 +170,7 @@ class cinder::api ( $sync_db = true, $public_endpoint = $::os_service_default, $osapi_volume_base_url = $::os_service_default, + $osapi_max_limit = $::os_service_default, # DEPRECATED PARAMETERS $validation_options = {}, ) { @@ -217,6 +223,7 @@ class cinder::api ( 'DEFAULT/default_volume_type': value => $default_volume_type; 'DEFAULT/public_endpoint': value => $public_endpoint; 'DEFAULT/osapi_volume_base_URL': value => $osapi_volume_base_url; + 'DEFAULT/osapi_max_limit': value => $osapi_max_limit; } cinder_config { diff --git a/spec/classes/cinder_api_spec.rb b/spec/classes/cinder_api_spec.rb index 3d1ee25e..c0d13fe2 100644 --- a/spec/classes/cinder_api_spec.rb +++ b/spec/classes/cinder_api_spec.rb @@ -43,6 +43,9 @@ describe 'cinder::api' do is_expected.to contain_cinder_config('DEFAULT/osapi_volume_base_URL').with( :value => '' ) + is_expected.to contain_cinder_config('DEFAULT/osapi_max_limit').with( + :value => '' + ) is_expected.to contain_cinder_config('DEFAULT/os_region_name').with( :value => '' ) @@ -289,6 +292,17 @@ describe 'cinder::api' do is_expected.to contain_cinder_config('keystone_authtoken/auth_uri').with_value("https://localhost:5000/") end end + + describe 'with a custom osapi_max_limit' do + let :params do + req_params.merge({'osapi_max_limit' => '10000'}) + end + it 'should configure the osapi_max_limit to 10000' do + is_expected.to contain_cinder_config('DEFAULT/osapi_max_limit').with( + :value => '10000' + ) + end + end end on_supported_os({