Update quota flags
Sync puppet module flags with latest nova quota parameters.
Changes:
- Flags 'quota_volumes' and 'quota_gigabytes' is now deprecated and has no effect
- Add 'quota_injected_files', 'quota_injected_file_content_bytes', 'quota_injected_file_path_bytes'
- Flags 'quota_max_injected_*' is now deprecated and has effect for the same 'quota_injected_*'
- Add 'quota_fixed_ips' and 'until_refresh'
Reference:
- Standardize quota flag format
97074667b5
Change-Id: Ia67e80725ed2b9171950764729143f7307fef450
This commit is contained in:
@@ -17,30 +17,46 @@
|
||||
# Defaults to 51200
|
||||
#
|
||||
# [*quota_volumes*]
|
||||
# (optional) Number of volumes
|
||||
# Defaults to 10
|
||||
# (optional) Deprecated. This parameter does nothing and will be removed.
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*quota_gigabytes*]
|
||||
# (optional) Amount of ephemeral disk storage in GB
|
||||
# Defaults to 1000
|
||||
# (optional) Deprecated. This parameter does nothing and will be removed.
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*quota_floating_ips*]
|
||||
# (optional) Number of floating IPs
|
||||
# Defaults to 10
|
||||
#
|
||||
# [*quota_fixed_ips*]
|
||||
# (optional) Number of fixed IPs (this should be at least the number of instances allowed)
|
||||
# Defaults to -1
|
||||
#
|
||||
# [*quota_metadata_items*]
|
||||
# (optional) Number of metadata items per instance
|
||||
# Defaults to 128
|
||||
#
|
||||
# [*quota_max_injected_files*]
|
||||
# (optional) Deprecated. Use quota_injected_files instead
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*quota_max_injected_file_content_bytes*]
|
||||
# (optional) Deprecated. Use quota_injected_file_content_bytes instead
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*quota_max_injected_file_path_bytes*]
|
||||
# (optional) Deprecated. Use quota_injected_file_path_bytes instead
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*quota_injected_files*]
|
||||
# (optional) Number of files that can be injected per instance
|
||||
# Defaults to 5
|
||||
#
|
||||
# [*quota_max_injected_file_content_bytes*]
|
||||
# [*quota_injected_file_content_bytes*]
|
||||
# (optional) Maximum size in bytes of injected files
|
||||
# Defaults to 10240
|
||||
#
|
||||
# [*quota_max_injected_file_path_bytes*]
|
||||
# [*quota_injected_file_path_bytes*]
|
||||
# (optional) Maximum size in bytes of injected file path
|
||||
# Defaults to 255
|
||||
#
|
||||
@@ -54,12 +70,16 @@
|
||||
#
|
||||
# [*quota_key_pairs*]
|
||||
# (optional) Number of key pairs
|
||||
# Defaults to 10
|
||||
# Defaults to 100
|
||||
#
|
||||
# [*reservation_expire*]
|
||||
# (optional) Time until reservations expire in seconds
|
||||
# Defaults to 86400
|
||||
#
|
||||
# [*until_refresh*]
|
||||
# (optional) Count of reservations until usage is refreshed
|
||||
# Defaults to 0
|
||||
#
|
||||
# [*max_age*]
|
||||
# (optional) Number of seconds between subsequent usage refreshes
|
||||
# Defaults to 0
|
||||
@@ -72,36 +92,71 @@ class nova::quota(
|
||||
$quota_instances = 10,
|
||||
$quota_cores = 20,
|
||||
$quota_ram = 51200,
|
||||
$quota_volumes = 10,
|
||||
$quota_gigabytes = 1000,
|
||||
$quota_floating_ips = 10,
|
||||
$quota_fixed_ips = -1,
|
||||
$quota_metadata_items = 128,
|
||||
$quota_max_injected_files = 5,
|
||||
$quota_max_injected_file_content_bytes = 10240,
|
||||
$quota_max_injected_file_path_bytes = 255,
|
||||
$quota_injected_files = 5,
|
||||
$quota_injected_file_content_bytes = 10240,
|
||||
$quota_injected_file_path_bytes = 255,
|
||||
$quota_security_groups = 10,
|
||||
$quota_security_group_rules = 20,
|
||||
$quota_key_pairs = 10,
|
||||
$quota_key_pairs = 100,
|
||||
$reservation_expire = 86400,
|
||||
$until_refresh = 0,
|
||||
$max_age = 0,
|
||||
$quota_driver = 'nova.quota.DbQuotaDriver'
|
||||
$quota_driver = 'nova.quota.DbQuotaDriver',
|
||||
# DEPRECATED PARAMETERS
|
||||
$quota_volumes = undef,
|
||||
$quota_gigabytes = undef,
|
||||
$quota_max_injected_files = undef,
|
||||
$quota_max_injected_file_content_bytes = undef,
|
||||
$quota_max_injected_file_path_bytes = undef
|
||||
) {
|
||||
|
||||
if $quota_volumes {
|
||||
warning('The quota_volumes parameter is deprecated and has no effect.')
|
||||
}
|
||||
|
||||
if $quota_gigabytes {
|
||||
warning('The quota_gigabytes parameter is deprecated and has no effect.')
|
||||
}
|
||||
|
||||
if $quota_max_injected_files {
|
||||
warning('The quota_max_injected_files parameter is deprecated, use quota_injected_files instead.')
|
||||
$quota_injected_files_real = $quota_max_injected_files
|
||||
} else {
|
||||
$quota_injected_files_real = $quota_injected_files
|
||||
}
|
||||
|
||||
if $quota_max_injected_file_content_bytes {
|
||||
warning('The quota_max_injected_file_content_bytes is deprecated, use quota_injected_file_content_bytes instead.')
|
||||
$quota_injected_file_content_bytes_real = $quota_max_injected_file_content_bytes
|
||||
} else {
|
||||
$quota_injected_file_content_bytes_real = $quota_injected_file_content_bytes
|
||||
}
|
||||
|
||||
if $quota_max_injected_file_path_bytes {
|
||||
warning('The quota_max_injected_file_path_bytes parameter is deprecated, use quota_injected_file_path_bytes instead.')
|
||||
$quota_injected_file_path_bytes_real = $quota_max_injected_file_path_bytes
|
||||
} else {
|
||||
$quota_injected_file_path_bytes_real = $quota_injected_file_path_bytes
|
||||
}
|
||||
|
||||
nova_config {
|
||||
'DEFAULT/quota_instances': value => $quota_instances;
|
||||
'DEFAULT/quota_cores': value => $quota_cores;
|
||||
'DEFAULT/quota_ram': value => $quota_ram;
|
||||
'DEFAULT/quota_volumes': value => $quota_volumes;
|
||||
'DEFAULT/quota_gigabytes': value => $quota_gigabytes;
|
||||
'DEFAULT/quota_floating_ips': value => $quota_floating_ips;
|
||||
'DEFAULT/quota_fixed_ips': value => $quota_fixed_ips;
|
||||
'DEFAULT/quota_metadata_items': value => $quota_metadata_items;
|
||||
'DEFAULT/quota_max_injected_files': value => $quota_max_injected_files;
|
||||
'DEFAULT/quota_max_injected_file_content_bytes': value => $quota_max_injected_file_content_bytes;
|
||||
'DEFAULT/quota_max_injected_file_path_bytes': value => $quota_max_injected_file_path_bytes;
|
||||
'DEFAULT/quota_injected_files': value => $quota_injected_files_real;
|
||||
'DEFAULT/quota_injected_file_content_bytes': value => $quota_injected_file_content_bytes_real;
|
||||
'DEFAULT/quota_injected_file_path_bytes': value => $quota_injected_file_path_bytes_real;
|
||||
'DEFAULT/quota_security_groups': value => $quota_security_groups;
|
||||
'DEFAULT/quota_security_group_rules': value => $quota_security_group_rules;
|
||||
'DEFAULT/quota_key_pairs': value => $quota_key_pairs;
|
||||
'DEFAULT/reservation_expire': value => $reservation_expire;
|
||||
'DEFAULT/until_refresh': value => $until_refresh;
|
||||
'DEFAULT/max_age': value => $max_age;
|
||||
'DEFAULT/quota_driver': value => $quota_driver
|
||||
}
|
||||
|
@@ -2,6 +2,84 @@ require 'spec_helper'
|
||||
|
||||
describe 'nova::quota' do
|
||||
|
||||
let :params do
|
||||
{}
|
||||
end
|
||||
|
||||
let :default_params do
|
||||
{ :quota_instances => 10,
|
||||
:quota_cores => 20,
|
||||
:quota_ram => 51200,
|
||||
:quota_floating_ips => 10,
|
||||
:quota_fixed_ips => -1,
|
||||
:quota_metadata_items => 128,
|
||||
:quota_injected_files => 5,
|
||||
:quota_injected_file_content_bytes => 10240,
|
||||
:quota_injected_file_path_bytes => 255,
|
||||
:quota_security_groups => 10,
|
||||
:quota_security_group_rules => 20,
|
||||
:quota_key_pairs => 100,
|
||||
:reservation_expire => 86400,
|
||||
:until_refresh => 0,
|
||||
:max_age => 0,
|
||||
:quota_driver => 'nova.quota.DbQuotaDriver' }
|
||||
end
|
||||
|
||||
shared_examples_for 'nova quota' do
|
||||
let :params_hash do
|
||||
default_params.merge(params)
|
||||
end
|
||||
|
||||
it 'configures quota in nova.conf' do
|
||||
params_hash.each_pair do |config,value|
|
||||
should contain_nova_config("DEFAULT/#{config}").with_value( value )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with default parameters' do
|
||||
it_configures 'nova quota'
|
||||
end
|
||||
|
||||
context 'with provided parameters' do
|
||||
before do
|
||||
params.merge!({
|
||||
:quota_instances => 20,
|
||||
:quota_cores => 40,
|
||||
:quota_ram => 102400,
|
||||
:quota_floating_ips => 20,
|
||||
:quota_fixed_ips => 512,
|
||||
:quota_metadata_items => 256,
|
||||
:quota_injected_files => 10,
|
||||
:quota_injected_file_content_bytes => 20480,
|
||||
:quota_injected_file_path_bytes => 254,
|
||||
:quota_security_groups => 20,
|
||||
:quota_security_group_rules => 40,
|
||||
:quota_key_pairs => 200,
|
||||
:reservation_expire => 6400,
|
||||
:until_refresh => 30,
|
||||
:max_age => 60
|
||||
})
|
||||
end
|
||||
|
||||
it_configures 'nova quota'
|
||||
end
|
||||
|
||||
context 'with deprecated parameters' do
|
||||
let :params do {
|
||||
:quota_max_injected_files => 10,
|
||||
:quota_max_injected_file_content_bytes => 20480,
|
||||
:quota_max_injected_file_path_bytes => 254
|
||||
}
|
||||
end
|
||||
|
||||
it {
|
||||
should contain_nova_config('DEFAULT/quota_injected_files').with_value('10')
|
||||
should contain_nova_config('DEFAULT/quota_injected_file_content_bytes').with_value('20480')
|
||||
should contain_nova_config('DEFAULT/quota_injected_file_path_bytes').with_value('254')
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_nova_config('DEFAULT/quota_ram').with_value('51200') }
|
||||
|
||||
describe 'when overriding params' do
|
||||
|
Reference in New Issue
Block a user