Add support for quota parameters for share replicas

This patch introduces new parameters in manila::quota class so that
operators can set quota parameters for share replicas.

Also, this patch removes re-defining default value in quota class,
and make it use the default value defined in Manila itself.

Change-Id: I0b51037b19e101a3f1168e2999c26ffe871ec4d4
This commit is contained in:
Takashi Kajinami 2020-06-18 13:43:59 +09:00
parent 7de05c9f38
commit 151859634a
3 changed files with 67 additions and 34 deletions

View File

@ -5,49 +5,61 @@
# === Parameters # === Parameters
# #
# [*quota_shares*] # [*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*] # [*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*] # [*quota_gigabytes*]
# (optional) Number of share gigabytes (snapshots are also included) # (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*] # [*quota_driver*]
# (optional) Default driver to use for quota checks. # (optional) Default driver to use for quota checks.
# Defaults to 'manila.quota.DbQuotaDriver'. # Defaults to $::os_service_default.
# #
# [*quota_snapshot_gigabytes*] # [*quota_snapshot_gigabytes*]
# (optional) Number of snapshot gigabytes allowed per project. # (optional) Number of snapshot gigabytes allowed per project.
# Defaults to 1000. # Defaults to $::os_service_default.
# #
# [*quota_share_networks*] # [*quota_share_networks*]
# (optional) Number of share-networks allowed per project. # (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*] # [*reservation_expire*]
# (optional) Number of seconds until a reservation expires. # (optional) Number of seconds until a reservation expires.
# Defaults to 86400. # Defaults to $::os_service_default.
# #
# [*until_refresh*] # [*until_refresh*]
# (optional) Count of reservations until usage is refreshed. # (optional) Count of reservations until usage is refreshed.
# Defaults to 0. # Defaults to $::os_service_default.
# #
# [*max_age*] # [*max_age*]
# (optional) Number of seconds between subsequent usage refreshes. # (optional) Number of seconds between subsequent usage refreshes.
# Defaults to 0. # Defaults to $:os_service_default.
# #
class manila::quota ( class manila::quota (
$quota_shares = 10, $quota_shares = $::os_service_default,
$quota_snapshots = 10, $quota_snapshots = $::os_service_default,
$quota_gigabytes = 1000, $quota_gigabytes = $::os_service_default,
$quota_driver = 'manila.quota.DbQuotaDriver', $quota_driver = $::os_service_default,
$quota_snapshot_gigabytes = 1000, $quota_snapshot_gigabytes = $::os_service_default,
$quota_share_networks = 10, $quota_share_networks = $::os_service_default,
$reservation_expire = 86400, $quota_share_replicas = $::os_service_default,
$until_refresh = 0, $quota_replica_gigabytes = $::os_service_default,
$max_age = 0, $reservation_expire = $::os_service_default,
$until_refresh = $::os_service_default,
$max_age = $::os_service_default,
) { ) {
include manila::deps include manila::deps
@ -59,6 +71,8 @@ class manila::quota (
'DEFAULT/quota_driver': value => $quota_driver; 'DEFAULT/quota_driver': value => $quota_driver;
'DEFAULT/quota_snapshot_gigabytes': value => $quota_snapshot_gigabytes; 'DEFAULT/quota_snapshot_gigabytes': value => $quota_snapshot_gigabytes;
'DEFAULT/quota_share_networks': value => $quota_share_networks; '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/reservation_expire': value => $reservation_expire;
'DEFAULT/until_refresh': value => $until_refresh; 'DEFAULT/until_refresh': value => $until_refresh;
'DEFAULT/max_age': value => $max_age; '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,23 +6,27 @@ describe 'manila::quota' do
context 'with default parameters' do context 'with default parameters' do
it 'contains default values' do it 'contains default values' do
is_expected.to contain_manila_config('DEFAULT/quota_shares').with( 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( 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( 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( 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( 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( 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( 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( 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( is_expected.to contain_manila_config('DEFAULT/max_age').with(
:value => 0) :value => '<SERVICE DEFAULT>')
end end
end end
@ -31,8 +35,11 @@ describe 'manila::quota' do
{ :quota_shares => 1000, { :quota_shares => 1000,
:quota_snapshots => 1000, :quota_snapshots => 1000,
:quota_gigabytes => 100000, :quota_gigabytes => 100000,
:quota_driver => 'manila.quota.DbQuotaDriver',
:quota_snapshot_gigabytes => 10000, :quota_snapshot_gigabytes => 10000,
:quota_share_networks => 100, :quota_share_networks => 100,
:quota_share_replicas => 10,
:quota_replica_gigabytes => 100,
:reservation_expire => 864000, :reservation_expire => 864000,
:until_refresh => 10, :until_refresh => 10,
:max_age => 10,} :max_age => 10,}
@ -50,6 +57,10 @@ describe 'manila::quota' do
:value => 10000) :value => 10000)
is_expected.to contain_manila_config('DEFAULT/quota_share_networks').with( is_expected.to contain_manila_config('DEFAULT/quota_share_networks').with(
:value => 100) :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( is_expected.to contain_manila_config('DEFAULT/reservation_expire').with(
:value => 864000) :value => 864000)
is_expected.to contain_manila_config('DEFAULT/until_refresh').with( is_expected.to contain_manila_config('DEFAULT/until_refresh').with(