Add options to use remove_unused_* parameters
Being able to modify the parameters "remove_unused_base_images", "remove_unused_original_minimum_age_seconds", "remove_unused_kernels", "remove_unused_resized_minimum_age_seconds" if desired. Change-Id: Ia24594ccc4b999674456e59a279e2d5916cd5d7a Implements: blueprint add-remove-unused-parameters
This commit is contained in:
@@ -31,15 +31,49 @@
|
|||||||
# will be removed from nova.conf completely.
|
# will be removed from nova.conf completely.
|
||||||
# Defaults to an empty list
|
# Defaults to an empty list
|
||||||
#
|
#
|
||||||
|
# [*remove_unused_base_images*]
|
||||||
|
# (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
|
||||||
|
#
|
||||||
|
# [*remove_unused_kernels*]
|
||||||
|
# (optional) Should unused kernel images be removed?
|
||||||
|
# This is only safe to enable if all compute nodes
|
||||||
|
# have been updated to support this option.
|
||||||
|
# If undef is specified, remove the line in nova.conf
|
||||||
|
# otherwise, use a boolean to remove or not the kernels.
|
||||||
|
# Defaults to undef
|
||||||
|
#
|
||||||
|
# [*remove_unused_resized_minimum_age_seconds*]
|
||||||
|
# (optional) Unused resized base images younger
|
||||||
|
# than this will not be removed
|
||||||
|
# If undef is specified, remove the line in nove.conf
|
||||||
|
# otherwise, use a integer or a string to define after
|
||||||
|
# how many seconds it will be removed.
|
||||||
|
# Defaults to undef
|
||||||
|
#
|
||||||
|
# [*remove_unused_original_minimum_age_seconds*]
|
||||||
|
# (optional) Unused unresized base images younger
|
||||||
|
# than this will not be removed
|
||||||
|
# If undef is specified, remove the line in nove.conf
|
||||||
|
# otherwise, use a integer or a string to define after
|
||||||
|
# how many seconds it will be removed.
|
||||||
|
# Defaults to undef
|
||||||
|
#
|
||||||
|
|
||||||
class nova::compute::libvirt (
|
class nova::compute::libvirt (
|
||||||
$libvirt_virt_type = 'kvm',
|
$libvirt_virt_type = 'kvm',
|
||||||
$vncserver_listen = '127.0.0.1',
|
$vncserver_listen = '127.0.0.1',
|
||||||
$migration_support = false,
|
$migration_support = false,
|
||||||
$libvirt_cpu_mode = false,
|
$libvirt_cpu_mode = false,
|
||||||
$libvirt_disk_cachemodes = [],
|
$libvirt_disk_cachemodes = [],
|
||||||
|
$remove_unused_base_images = undef,
|
||||||
|
$remove_unused_kernels = undef,
|
||||||
|
$remove_unused_resized_minimum_age_seconds = undef,
|
||||||
|
$remove_unused_original_minimum_age_seconds = undef,
|
||||||
# DEPRECATED PARAMETER
|
# DEPRECATED PARAMETER
|
||||||
$libvirt_type = false
|
$libvirt_type = false
|
||||||
) {
|
) {
|
||||||
|
|
||||||
include nova::params
|
include nova::params
|
||||||
@@ -121,4 +155,44 @@ class nova::compute::libvirt (
|
|||||||
'libvirt/disk_cachemodes': ensure => absent;
|
'libvirt/disk_cachemodes': ensure => absent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if $remove_unused_kernels != undef {
|
||||||
|
nova_config {
|
||||||
|
'libvirt/remove_unused_kernels': value => $remove_unused_kernels;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
nova_config {
|
||||||
|
'libvirt/remove_unused_kernels': ensure => absent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 {
|
||||||
|
nova_config {
|
||||||
|
'libvirt/remove_unused_resized_minimum_age_seconds': ensure => absent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if $remove_unused_base_images != undef {
|
||||||
|
nova_config {
|
||||||
|
'DEFAULT/remove_unused_base_images': value => $remove_unused_base_images;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
nova_config {
|
||||||
|
'DEFAULT/remove_unused_base_images': ensure => absent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 {
|
||||||
|
nova_config {
|
||||||
|
'DEFAULT/remove_unused_original_minimum_age_seconds': ensure => absent;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -38,14 +38,22 @@ describe 'nova::compute::libvirt' do
|
|||||||
it { should contain_nova_config('libvirt/cpu_mode').with_value('host-model')}
|
it { should contain_nova_config('libvirt/cpu_mode').with_value('host-model')}
|
||||||
it { should contain_nova_config('libvirt/disk_cachemodes').with_ensure('absent')}
|
it { should contain_nova_config('libvirt/disk_cachemodes').with_ensure('absent')}
|
||||||
it { should contain_nova_config('DEFAULT/vncserver_listen').with_value('127.0.0.1')}
|
it { should contain_nova_config('DEFAULT/vncserver_listen').with_value('127.0.0.1')}
|
||||||
|
it { should contain_nova_config('DEFAULT/remove_unused_base_images').with_ensure('absent')}
|
||||||
|
it { should contain_nova_config('DEFAULT/remove_unused_original_minimum_age_seconds').with_ensure('absent')}
|
||||||
|
it { should contain_nova_config('libvirt/remove_unused_kernels').with_ensure('absent')}
|
||||||
|
it { should contain_nova_config('libvirt/remove_unused_resized_minimum_age_seconds').with_ensure('absent')}
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'with params' do
|
describe 'with params' do
|
||||||
let :params do
|
let :params do
|
||||||
{ :libvirt_virt_type => 'qemu',
|
{ :libvirt_virt_type => 'qemu',
|
||||||
:vncserver_listen => '0.0.0.0',
|
:vncserver_listen => '0.0.0.0',
|
||||||
:libvirt_cpu_mode => 'host-passthrough',
|
:libvirt_cpu_mode => 'host-passthrough',
|
||||||
:libvirt_disk_cachemodes => ['file=directsync','block=none']
|
:libvirt_disk_cachemodes => ['file=directsync','block=none'],
|
||||||
|
:remove_unused_base_images => true,
|
||||||
|
:remove_unused_kernels => true,
|
||||||
|
:remove_unused_resized_minimum_age_seconds => 3600,
|
||||||
|
:remove_unused_original_minimum_age_seconds => 3600
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -53,6 +61,10 @@ describe 'nova::compute::libvirt' do
|
|||||||
it { should contain_nova_config('libvirt/cpu_mode').with_value('host-passthrough')}
|
it { should contain_nova_config('libvirt/cpu_mode').with_value('host-passthrough')}
|
||||||
it { should contain_nova_config('libvirt/disk_cachemodes').with_value('file=directsync,block=none')}
|
it { should contain_nova_config('libvirt/disk_cachemodes').with_value('file=directsync,block=none')}
|
||||||
it { should contain_nova_config('DEFAULT/vncserver_listen').with_value('0.0.0.0')}
|
it { should contain_nova_config('DEFAULT/vncserver_listen').with_value('0.0.0.0')}
|
||||||
|
it { should contain_nova_config('DEFAULT/remove_unused_base_images').with_value(true)}
|
||||||
|
it { should contain_nova_config('DEFAULT/remove_unused_original_minimum_age_seconds').with_value(3600)}
|
||||||
|
it { should contain_nova_config('libvirt/remove_unused_kernels').with_value(true)}
|
||||||
|
it { should contain_nova_config('libvirt/remove_unused_resized_minimum_age_seconds').with_value(3600)}
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'with deprecated params' do
|
describe 'with deprecated params' do
|
||||||
@@ -121,17 +133,29 @@ describe 'nova::compute::libvirt' do
|
|||||||
it { should contain_nova_config('DEFAULT/compute_driver').with_value('libvirt.LibvirtDriver')}
|
it { should contain_nova_config('DEFAULT/compute_driver').with_value('libvirt.LibvirtDriver')}
|
||||||
it { should contain_nova_config('libvirt/virt_type').with_value('kvm')}
|
it { should contain_nova_config('libvirt/virt_type').with_value('kvm')}
|
||||||
it { should contain_nova_config('DEFAULT/vncserver_listen').with_value('127.0.0.1')}
|
it { should contain_nova_config('DEFAULT/vncserver_listen').with_value('127.0.0.1')}
|
||||||
|
it { should contain_nova_config('DEFAULT/remove_unused_base_images').with_ensure('absent')}
|
||||||
|
it { should contain_nova_config('DEFAULT/remove_unused_original_minimum_age_seconds').with_ensure('absent')}
|
||||||
|
it { should contain_nova_config('libvirt/remove_unused_kernels').with_ensure('absent')}
|
||||||
|
it { should contain_nova_config('libvirt/remove_unused_resized_minimum_age_seconds').with_ensure('absent')}
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'with params' do
|
describe 'with params' do
|
||||||
let :params do
|
let :params do
|
||||||
{ :libvirt_virt_type => 'qemu',
|
{ :libvirt_virt_type => 'qemu',
|
||||||
:vncserver_listen => '0.0.0.0'
|
:vncserver_listen => '0.0.0.0',
|
||||||
|
:remove_unused_base_images => true,
|
||||||
|
:remove_unused_kernels => true,
|
||||||
|
:remove_unused_resized_minimum_age_seconds => 3600,
|
||||||
|
:remove_unused_original_minimum_age_seconds => 3600
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
it { should contain_nova_config('libvirt/virt_type').with_value('qemu')}
|
it { should contain_nova_config('libvirt/virt_type').with_value('qemu')}
|
||||||
it { should contain_nova_config('DEFAULT/vncserver_listen').with_value('0.0.0.0')}
|
it { should contain_nova_config('DEFAULT/vncserver_listen').with_value('0.0.0.0')}
|
||||||
|
it { should contain_nova_config('DEFAULT/remove_unused_base_images').with_value(true)}
|
||||||
|
it { should contain_nova_config('DEFAULT/remove_unused_original_minimum_age_seconds').with_value(3600)}
|
||||||
|
it { should contain_nova_config('libvirt/remove_unused_kernels').with_value(true)}
|
||||||
|
it { should contain_nova_config('libvirt/remove_unused_resized_minimum_age_seconds').with_value(3600)}
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'with deprecated params' do
|
describe 'with deprecated params' do
|
||||||
|
Reference in New Issue
Block a user