Merge "Add support for quota parameters for share replicas"

This commit is contained in:
Zuul 2020-06-18 14:33:24 +00:00 committed by Gerrit Code Review
commit 228f415659
3 changed files with 67 additions and 34 deletions

View File

@ -5,49 +5,61 @@
# === Parameters
#
# [*quota_shares*]
# (optional) Number of shares allowed per project. Defaults to 10.
# (optional) Number of shares allowed per project.
# Defaults to $::os_service_default.
#
# [*quota_snapshots*]
# (optional) Number of share snapshots allowed per project. Defaults to 10.
# (optional) Number of share snapshots allowed per project.
# Defaults to $::os_service_default.
#
# [*quota_gigabytes*]
# (optional) Number of share gigabytes (snapshots are also included)
# allowed per project. Defaults to 1000.
# allowed per project. Defaults to $::os_service_default.
#
# [*quota_driver*]
# (optional) Default driver to use for quota checks.
# Defaults to 'manila.quota.DbQuotaDriver'.
# Defaults to $::os_service_default.
#
# [*quota_snapshot_gigabytes*]
# (optional) Number of snapshot gigabytes allowed per project.
# Defaults to 1000.
# Defaults to $::os_service_default.
#
# [*quota_share_networks*]
# (optional) Number of share-networks allowed per project.
# Defaults to 10.
# Defaults to $::os_service_default.
#
# [*quota_share_replicas*]
# (optional) Number of share-replicas allowed per project.
# Defaults to $::os_service_default.
#
# [*quota_replica_gigabytes*]
# (optional) Number of replica gigabytes allowed per project.
# Defaults to $::os_service_default.
#
# [*reservation_expire*]
# (optional) Number of seconds until a reservation expires.
# Defaults to 86400.
# Defaults to $::os_service_default.
#
# [*until_refresh*]
# (optional) Count of reservations until usage is refreshed.
# Defaults to 0.
# Defaults to $::os_service_default.
#
# [*max_age*]
# (optional) Number of seconds between subsequent usage refreshes.
# Defaults to 0.
# Defaults to $:os_service_default.
#
class manila::quota (
$quota_shares = 10,
$quota_snapshots = 10,
$quota_gigabytes = 1000,
$quota_driver = 'manila.quota.DbQuotaDriver',
$quota_snapshot_gigabytes = 1000,
$quota_share_networks = 10,
$reservation_expire = 86400,
$until_refresh = 0,
$max_age = 0,
$quota_shares = $::os_service_default,
$quota_snapshots = $::os_service_default,
$quota_gigabytes = $::os_service_default,
$quota_driver = $::os_service_default,
$quota_snapshot_gigabytes = $::os_service_default,
$quota_share_networks = $::os_service_default,
$quota_share_replicas = $::os_service_default,
$quota_replica_gigabytes = $::os_service_default,
$reservation_expire = $::os_service_default,
$until_refresh = $::os_service_default,
$max_age = $::os_service_default,
) {
include manila::deps
@ -59,6 +71,8 @@ class manila::quota (
'DEFAULT/quota_driver': value => $quota_driver;
'DEFAULT/quota_snapshot_gigabytes': value => $quota_snapshot_gigabytes;
'DEFAULT/quota_share_networks': value => $quota_share_networks;
'DEFAULT/quota_share_replicas': value => $quota_share_replicas;
'DEFAULT/quota_replica_gigabytes': value => $quota_replica_gigabytes;
'DEFAULT/reservation_expire': value => $reservation_expire;
'DEFAULT/until_refresh': value => $until_refresh;
'DEFAULT/max_age': value => $max_age;

View File

@ -0,0 +1,8 @@
---
features:
- |
The following new options were added so that operators can set quota
parameters for share replica.
- ``manila::quota::quota_share_replicas``
- ``manila::quota::quota_replica_gigabytes``

View File

@ -6,36 +6,43 @@ describe 'manila::quota' do
context 'with default parameters' do
it 'contains default values' do
is_expected.to contain_manila_config('DEFAULT/quota_shares').with(
:value => 10)
:value => '<SERVICE DEFAULT>')
is_expected.to contain_manila_config('DEFAULT/quota_snapshots').with(
:value => 10)
:value => '<SERVICE DEFAULT>')
is_expected.to contain_manila_config('DEFAULT/quota_gigabytes').with(
:value => 1000)
:value => '<SERVICE DEFAULT>')
is_expected.to contain_manila_config('DEFAULT/quota_driver').with(
:value => 'manila.quota.DbQuotaDriver')
:value => '<SERVICE DEFAULT>')
is_expected.to contain_manila_config('DEFAULT/quota_snapshot_gigabytes').with(
:value => 1000)
:value => '<SERVICE DEFAULT>')
is_expected.to contain_manila_config('DEFAULT/quota_share_networks').with(
:value => 10)
:value => '<SERVICE DEFAULT>')
is_expected.to contain_manila_config('DEFAULT/quota_share_replicas').with(
:value => '<SERVICE DEFAULT>')
is_expected.to contain_manila_config('DEFAULT/quota_replica_gigabytes').with(
:value => '<SERVICE DEFAULT>')
is_expected.to contain_manila_config('DEFAULT/reservation_expire').with(
:value => 86400)
:value => '<SERVICE DEFAULT>')
is_expected.to contain_manila_config('DEFAULT/until_refresh').with(
:value => 0)
:value => '<SERVICE DEFAULT>')
is_expected.to contain_manila_config('DEFAULT/max_age').with(
:value => 0)
:value => '<SERVICE DEFAULT>')
end
end
context 'with overridden parameters' do
let :params do
{ :quota_shares => 1000,
:quota_snapshots => 1000,
:quota_gigabytes => 100000,
{ :quota_shares => 1000,
:quota_snapshots => 1000,
:quota_gigabytes => 100000,
:quota_driver => 'manila.quota.DbQuotaDriver',
:quota_snapshot_gigabytes => 10000,
:quota_share_networks => 100,
:reservation_expire => 864000,
:until_refresh => 10,
:max_age => 10,}
:quota_share_networks => 100,
:quota_share_replicas => 10,
:quota_replica_gigabytes => 100,
:reservation_expire => 864000,
:until_refresh => 10,
:max_age => 10,}
end
it 'contains overrided values' do
is_expected.to contain_manila_config('DEFAULT/quota_shares').with(
@ -50,6 +57,10 @@ describe 'manila::quota' do
:value => 10000)
is_expected.to contain_manila_config('DEFAULT/quota_share_networks').with(
:value => 100)
is_expected.to contain_manila_config('DEFAULT/quota_share_replicas').with(
:value => 10)
is_expected.to contain_manila_config('DEFAULT/quota_replica_gigabytes').with(
:value => 100)
is_expected.to contain_manila_config('DEFAULT/reservation_expire').with(
:value => 864000)
is_expected.to contain_manila_config('DEFAULT/until_refresh').with(