From 151859634a3a8a3fcd6cd96ead7a318bd09d8dd4 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Thu, 18 Jun 2020 13:43:59 +0900 Subject: [PATCH] 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 --- manifests/quota.pp | 50 ++++++++++++------- .../add-replica-quotas-9d838dc338d4cfce.yaml | 8 +++ spec/classes/manila_quota_spec.rb | 43 ++++++++++------ 3 files changed, 67 insertions(+), 34 deletions(-) create mode 100644 releasenotes/notes/add-replica-quotas-9d838dc338d4cfce.yaml diff --git a/manifests/quota.pp b/manifests/quota.pp index 818a6a63..a84a7bdf 100644 --- a/manifests/quota.pp +++ b/manifests/quota.pp @@ -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; diff --git a/releasenotes/notes/add-replica-quotas-9d838dc338d4cfce.yaml b/releasenotes/notes/add-replica-quotas-9d838dc338d4cfce.yaml new file mode 100644 index 00000000..421c0435 --- /dev/null +++ b/releasenotes/notes/add-replica-quotas-9d838dc338d4cfce.yaml @@ -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`` diff --git a/spec/classes/manila_quota_spec.rb b/spec/classes/manila_quota_spec.rb index 665e6510..2ac002e9 100644 --- a/spec/classes/manila_quota_spec.rb +++ b/spec/classes/manila_quota_spec.rb @@ -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 => '') is_expected.to contain_manila_config('DEFAULT/quota_snapshots').with( - :value => 10) + :value => '') is_expected.to contain_manila_config('DEFAULT/quota_gigabytes').with( - :value => 1000) + :value => '') is_expected.to contain_manila_config('DEFAULT/quota_driver').with( - :value => 'manila.quota.DbQuotaDriver') + :value => '') is_expected.to contain_manila_config('DEFAULT/quota_snapshot_gigabytes').with( - :value => 1000) + :value => '') is_expected.to contain_manila_config('DEFAULT/quota_share_networks').with( - :value => 10) + :value => '') + is_expected.to contain_manila_config('DEFAULT/quota_share_replicas').with( + :value => '') + is_expected.to contain_manila_config('DEFAULT/quota_replica_gigabytes').with( + :value => '') is_expected.to contain_manila_config('DEFAULT/reservation_expire').with( - :value => 86400) + :value => '') is_expected.to contain_manila_config('DEFAULT/until_refresh').with( - :value => 0) + :value => '') is_expected.to contain_manila_config('DEFAULT/max_age').with( - :value => 0) + :value => '') 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(