quota: Support unified limits options

Depends-on: https://review.opendev.org/924025
Change-Id: I0f749c25451ca7da82a1195265bc84450338c0eb
This commit is contained in:
Takashi Kajinami 2024-12-09 18:51:24 +09:00
parent 143ba1e0bf
commit b7a90e0cf9
3 changed files with 77 additions and 53 deletions

View File

@ -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), ',');
}
}

View File

@ -0,0 +1,7 @@
---
features:
- |
The following parameters have been added to the ``nova::quota`` class.
- ``unified_limits_resource_strategy``
- ``unified_limits_resource_list``

View File

@ -7,19 +7,21 @@ describe 'nova::quota' do
let :default_params do
{
:driver => '<SERVICE DEFAULT>',
:instances => '<SERVICE DEFAULT>',
:cores => '<SERVICE DEFAULT>',
:ram => '<SERVICE DEFAULT>',
:metadata_items => '<SERVICE DEFAULT>',
:injected_files => '<SERVICE DEFAULT>',
:injected_file_content_bytes => '<SERVICE DEFAULT>',
:injected_file_path_length => '<SERVICE DEFAULT>',
:key_pairs => '<SERVICE DEFAULT>',
:server_groups => '<SERVICE DEFAULT>',
:server_group_members => '<SERVICE DEFAULT>',
:recheck_quota => '<SERVICE DEFAULT>',
:count_usage_from_placement => '<SERVICE DEFAULT>',
:driver => '<SERVICE DEFAULT>',
:instances => '<SERVICE DEFAULT>',
:cores => '<SERVICE DEFAULT>',
:ram => '<SERVICE DEFAULT>',
:metadata_items => '<SERVICE DEFAULT>',
:injected_files => '<SERVICE DEFAULT>',
:injected_file_content_bytes => '<SERVICE DEFAULT>',
:injected_file_path_length => '<SERVICE DEFAULT>',
:key_pairs => '<SERVICE DEFAULT>',
:server_groups => '<SERVICE DEFAULT>',
:server_group_members => '<SERVICE DEFAULT>',
:recheck_quota => '<SERVICE DEFAULT>',
:count_usage_from_placement => '<SERVICE DEFAULT>',
:unified_limits_resource_strategy => '<SERVICE DEFAULT>',
:unified_limits_resource_list => '<SERVICE DEFAULT>',
}
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