From b7a90e0cf9a7db20ffea7768156741b1ad65d269 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Mon, 9 Dec 2024 18:51:24 +0900 Subject: [PATCH] quota: Support unified limits options Depends-on: https://review.opendev.org/924025 Change-Id: I0f749c25451ca7da82a1195265bc84450338c0eb --- manifests/quota.pp | 67 +++++++++++-------- .../unified-limits-opts-683eaf00a60d7b69.yaml | 7 ++ spec/classes/nova_quota_spec.rb | 56 +++++++++------- 3 files changed, 77 insertions(+), 53 deletions(-) create mode 100644 releasenotes/notes/unified-limits-opts-683eaf00a60d7b69.yaml diff --git a/manifests/quota.pp b/manifests/quota.pp index 4f56efd18..443643d4e 100644 --- a/manifests/quota.pp +++ b/manifests/quota.pp @@ -54,40 +54,53 @@ # Defaults to $facts['os_service_default'] # # [*count_usage_from_placement*] -# (optional Enable the counting of quota usage from the placement service. +# (optional) Enable the counting of quota usage from the placement service. +# Defaults to $facts['os_service_default'] +# +# [*unified_limits_resource_strategy*] +# (optional) Specify the semantics of the ``unified_limits_resource_list``. +# Defaults to $facts['os_service_default'] +# +# [*unified_limits_resource_list*] +# (optional) Specify a list of resources to require or ignore registered +# limits. # Defaults to $facts['os_service_default'] # class nova::quota( - $driver = $facts['os_service_default'], - $instances = $facts['os_service_default'], - $cores = $facts['os_service_default'], - $ram = $facts['os_service_default'], - $metadata_items = $facts['os_service_default'], - $injected_files = $facts['os_service_default'], - $injected_file_content_bytes = $facts['os_service_default'], - $injected_file_path_length = $facts['os_service_default'], - $key_pairs = $facts['os_service_default'], - $server_groups = $facts['os_service_default'], - $server_group_members = $facts['os_service_default'], - $recheck_quota = $facts['os_service_default'], - $count_usage_from_placement = $facts['os_service_default'], + $driver = $facts['os_service_default'], + $instances = $facts['os_service_default'], + $cores = $facts['os_service_default'], + $ram = $facts['os_service_default'], + $metadata_items = $facts['os_service_default'], + $injected_files = $facts['os_service_default'], + $injected_file_content_bytes = $facts['os_service_default'], + $injected_file_path_length = $facts['os_service_default'], + $key_pairs = $facts['os_service_default'], + $server_groups = $facts['os_service_default'], + $server_group_members = $facts['os_service_default'], + $recheck_quota = $facts['os_service_default'], + $count_usage_from_placement = $facts['os_service_default'], + $unified_limits_resource_strategy = $facts['os_service_default'], + $unified_limits_resource_list = $facts['os_service_default'], ) { include nova::deps nova_config { - 'quota/driver': value => $driver; - 'quota/instances': value => $instances; - 'quota/cores': value => $cores; - 'quota/ram': value => $ram; - 'quota/metadata_items': value => $metadata_items; - 'quota/injected_files': value => $injected_files; - 'quota/injected_file_content_bytes': value => $injected_file_content_bytes; - 'quota/injected_file_path_length': value => $injected_file_path_length; - 'quota/key_pairs': value => $key_pairs; - 'quota/server_groups': value => $server_groups; - 'quota/server_group_members': value => $server_group_members; - 'quota/recheck_quota': value => $recheck_quota; - 'quota/count_usage_from_placement': value => $count_usage_from_placement; + 'quota/driver': value => $driver; + 'quota/instances': value => $instances; + 'quota/cores': value => $cores; + 'quota/ram': value => $ram; + 'quota/metadata_items': value => $metadata_items; + 'quota/injected_files': value => $injected_files; + 'quota/injected_file_content_bytes': value => $injected_file_content_bytes; + 'quota/injected_file_path_length': value => $injected_file_path_length; + 'quota/key_pairs': value => $key_pairs; + 'quota/server_groups': value => $server_groups; + 'quota/server_group_members': value => $server_group_members; + 'quota/recheck_quota': value => $recheck_quota; + 'quota/count_usage_from_placement': value => $count_usage_from_placement; + 'quota/unified_limits_resource_strategy': value => $unified_limits_resource_strategy; + 'quota/unified_limits_resource_list': value => join(any2array($unified_limits_resource_list), ','); } } diff --git a/releasenotes/notes/unified-limits-opts-683eaf00a60d7b69.yaml b/releasenotes/notes/unified-limits-opts-683eaf00a60d7b69.yaml new file mode 100644 index 000000000..79a22cad2 --- /dev/null +++ b/releasenotes/notes/unified-limits-opts-683eaf00a60d7b69.yaml @@ -0,0 +1,7 @@ +--- +features: + - | + The following parameters have been added to the ``nova::quota`` class. + + - ``unified_limits_resource_strategy`` + - ``unified_limits_resource_list`` diff --git a/spec/classes/nova_quota_spec.rb b/spec/classes/nova_quota_spec.rb index 906429bc3..cf2b5c1c5 100644 --- a/spec/classes/nova_quota_spec.rb +++ b/spec/classes/nova_quota_spec.rb @@ -7,19 +7,21 @@ describe 'nova::quota' do let :default_params do { - :driver => '', - :instances => '', - :cores => '', - :ram => '', - :metadata_items => '', - :injected_files => '', - :injected_file_content_bytes => '', - :injected_file_path_length => '', - :key_pairs => '', - :server_groups => '', - :server_group_members => '', - :recheck_quota => '', - :count_usage_from_placement => '', + :driver => '', + :instances => '', + :cores => '', + :ram => '', + :metadata_items => '', + :injected_files => '', + :injected_file_content_bytes => '', + :injected_file_path_length => '', + :key_pairs => '', + :server_groups => '', + :server_group_members => '', + :recheck_quota => '', + :count_usage_from_placement => '', + :unified_limits_resource_strategy => '', + :unified_limits_resource_list => '', } end @@ -43,19 +45,21 @@ describe 'nova::quota' do context 'with provided parameters' do before do params.merge!({ - :driver => 'nova.quota.DbQuotaDriver', - :instances => 20, - :cores => 40, - :ram => 102400, - :metadata_items => 256, - :injected_files => 10, - :injected_file_content_bytes => 20480, - :injected_file_path_length => 254, - :key_pairs => 200, - :server_groups => 20, - :server_group_members => 20, - :recheck_quota => true, - :count_usage_from_placement => false, + :driver => 'nova.quota.DbQuotaDriver', + :instances => 20, + :cores => 40, + :ram => 102400, + :metadata_items => 256, + :injected_files => 10, + :injected_file_content_bytes => 20480, + :injected_file_path_length => 254, + :key_pairs => 200, + :server_groups => 20, + :server_group_members => 20, + :recheck_quota => true, + :count_usage_from_placement => false, + :unified_limits_resource_strategy => 'require', + :unified_limits_resource_list => 'servers', }) end