Merge "Use os_service_default instead of undef to unset parameters"

This commit is contained in:
Zuul 2020-09-18 15:13:45 +00:00 committed by Gerrit Code Review
commit b68017ce90
3 changed files with 45 additions and 27 deletions

View File

@ -86,7 +86,7 @@
# (optional) Should unused base images be removed?
# If undef is specified, remove the line in nova.conf
# otherwise, use a boolean to remove or not the base images.
# Defaults to undef
# Defaults to $::os_service_default
#
# [*remove_unused_resized_minimum_age_seconds*]
# (optional) Unused resized base images younger
@ -94,7 +94,7 @@
# If undef is specified, remove the line in nova.conf
# otherwise, use a integer or a string to define after
# how many seconds it will be removed.
# Defaults to undef
# Defaults to $::os_service_default
#
# [*remove_unused_original_minimum_age_seconds*]
# (optional) Unused unresized base images younger
@ -102,7 +102,7 @@
# If undef is specified, remove the line in nova.conf
# otherwise, use a integer or a string to define after
# how many seconds it will be removed.
# Defaults to undef
# Defaults to $::os_service_default
#
# [*libvirt_service_name*]
# (optional) libvirt service name.
@ -212,9 +212,9 @@ class nova::compute::libvirt (
$libvirt_inject_key = false,
$libvirt_inject_partition = -2,
$libvirt_enabled_perf_events = $::os_service_default,
$remove_unused_base_images = undef,
$remove_unused_resized_minimum_age_seconds = undef,
$remove_unused_original_minimum_age_seconds = undef,
$remove_unused_base_images = $::os_service_default,
$remove_unused_resized_minimum_age_seconds = $::os_service_default,
$remove_unused_original_minimum_age_seconds = $::os_service_default,
$libvirt_service_name = $::nova::params::libvirt_service_name,
$virtlock_service_name = $::nova::params::virtlock_service_name,
$virtlog_service_name = $::nova::params::virtlog_service_name,
@ -385,33 +385,39 @@ class nova::compute::libvirt (
}
}
if $remove_unused_resized_minimum_age_seconds != undef {
nova_config {
'libvirt/remove_unused_resized_minimum_age_seconds': value => $remove_unused_resized_minimum_age_seconds;
}
} else {
if $remove_unused_resized_minimum_age_seconds == undef {
warning('Use $::os_service_default instead of undef for the remove_unused_resized_minimum_age_seconds \
parameter. The current behavior for undef will be changed in a future release')
nova_config {
'libvirt/remove_unused_resized_minimum_age_seconds': ensure => absent;
}
} else {
nova_config {
'libvirt/remove_unused_resized_minimum_age_seconds': value => $remove_unused_resized_minimum_age_seconds;
}
}
if $remove_unused_base_images != undef {
nova_config {
'DEFAULT/remove_unused_base_images': value => $remove_unused_base_images;
}
} else {
if $remove_unused_base_images == undef {
warning('Use $::os_service_default instead of undef for the remove_unused_base_images \
parameter. The current behavior for undef will be changed in a future release')
nova_config {
'DEFAULT/remove_unused_base_images': ensure => absent;
}
} else {
nova_config {
'DEFAULT/remove_unused_base_images': value => $remove_unused_base_images;
}
}
if $remove_unused_original_minimum_age_seconds != undef {
nova_config {
'DEFAULT/remove_unused_original_minimum_age_seconds': value => $remove_unused_original_minimum_age_seconds;
}
} else {
if $remove_unused_original_minimum_age_seconds == undef {
warning('Use $::os_service_default instead of undef for the remove_unused_original_minimum_age_seconds \
parameter. The current behavior for undef will be changed in a future release')
nova_config {
'DEFAULT/remove_unused_original_minimum_age_seconds': ensure => absent;
}
} else {
nova_config {
'DEFAULT/remove_unused_original_minimum_age_seconds': value => $remove_unused_original_minimum_age_seconds;
}
}
}

View File

@ -0,0 +1,12 @@
---
upgrade:
- |
The default value of the following parameters has been changed to
$::os_service_default. The previous default, undef, can still be used to
remove parameters from config file, but this behavior will be removed
in a future release. Make sure that $::os_service_default is used instead
of undef.
- ``nova::compute::libvirt::remove_unused_resized_minimum_age_seconds``
- ``nova::compute::libvirt::remove_unused_base_images``
- ``nova::compute::libvirt::remove_unused_original_minimum_age_seconds``

View File

@ -57,9 +57,9 @@ describe 'nova::compute::libvirt' do
it { is_expected.to contain_nova_config('libvirt/inject_key').with_value(false)}
it { is_expected.to contain_nova_config('libvirt/inject_partition').with_value(-2)}
it { is_expected.to contain_nova_config('vnc/server_listen').with_value('127.0.0.1')}
it { is_expected.to contain_nova_config('DEFAULT/remove_unused_base_images').with_ensure('absent')}
it { is_expected.to contain_nova_config('DEFAULT/remove_unused_original_minimum_age_seconds').with_ensure('absent')}
it { is_expected.to contain_nova_config('libvirt/remove_unused_resized_minimum_age_seconds').with_ensure('absent')}
it { is_expected.to contain_nova_config('DEFAULT/remove_unused_base_images').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('DEFAULT/remove_unused_original_minimum_age_seconds').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/remove_unused_resized_minimum_age_seconds').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/rx_queue_size').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/tx_queue_size').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/volume_use_multipath').with_value('<SERVICE DEFAULT>')}
@ -292,9 +292,9 @@ describe 'nova::compute::libvirt' do
it { is_expected.to contain_nova_config('libvirt/inject_key').with_value(false)}
it { is_expected.to contain_nova_config('libvirt/inject_partition').with_value(-2)}
it { is_expected.to contain_nova_config('vnc/server_listen').with_value('127.0.0.1')}
it { is_expected.to contain_nova_config('DEFAULT/remove_unused_base_images').with_ensure('absent')}
it { is_expected.to contain_nova_config('DEFAULT/remove_unused_original_minimum_age_seconds').with_ensure('absent')}
it { is_expected.to contain_nova_config('libvirt/remove_unused_resized_minimum_age_seconds').with_ensure('absent')}
it { is_expected.to contain_nova_config('DEFAULT/remove_unused_base_images').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('DEFAULT/remove_unused_original_minimum_age_seconds').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/remove_unused_resized_minimum_age_seconds').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/nfs_mount_options').with_value('<SERVICE DEFAULT>')}
end