Add parameter to set image_type_exclude_list

Add support for the [compute]/image_type_exclude_list parameter to
prevent image types being reported as supported by a compute node.

Related nova change: Iabe6246dba212b1a287a82cc0cf16e2e8c8a24b8

Change-Id: I389d4b586468720d73ac69b025a3c34df54fe73e
This commit is contained in:
Oliver Walsh
2021-01-11 21:42:25 +00:00
parent 2590d170b8
commit 614b847449
3 changed files with 26 additions and 0 deletions

View File

@@ -263,6 +263,11 @@
# on creation. # on creation.
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*image_type_exclude_list*]
# (optional) List of image formats that should not be advertised as supported
# by the compute service.
# Defaults to $::os_service_default
#
# DEPRECATED PARAMETERS # DEPRECATED PARAMETERS
# #
# [*neutron_enabled*] # [*neutron_enabled*]
@@ -350,6 +355,7 @@ class nova::compute (
$running_deleted_instance_timeout = $::os_service_default, $running_deleted_instance_timeout = $::os_service_default,
$compute_monitors = $::os_service_default, $compute_monitors = $::os_service_default,
$default_ephemeral_format = $::os_service_default, $default_ephemeral_format = $::os_service_default,
$image_type_exclude_list = $::os_service_default,
# DEPRECATED PARAMETERS # DEPRECATED PARAMETERS
$neutron_enabled = undef, $neutron_enabled = undef,
$install_bridge_utils = undef, $install_bridge_utils = undef,
@@ -364,6 +370,8 @@ class nova::compute (
$cpu_shared_set_real = pick(join(any2array($cpu_shared_set), ','), $::os_service_default) $cpu_shared_set_real = pick(join(any2array($cpu_shared_set), ','), $::os_service_default)
$cpu_dedicated_set_real = pick(join(any2array($cpu_dedicated_set), ','), $::os_service_default) $cpu_dedicated_set_real = pick(join(any2array($cpu_dedicated_set), ','), $::os_service_default)
$image_type_exclude_list_real = pick(join(any2array($image_type_exclude_list), ','), $::os_service_default)
$max_concurrent_builds_real = pick( $max_concurrent_builds_real = pick(
$::nova::compute::ironic::max_concurrent_builds, $::nova::compute::ironic::max_concurrent_builds,
$max_concurrent_builds) $max_concurrent_builds)
@@ -513,6 +521,7 @@ Use the same parameter in nova::api class.')
'DEFAULT/running_deleted_instance_timeout': value => $running_deleted_instance_timeout; 'DEFAULT/running_deleted_instance_timeout': value => $running_deleted_instance_timeout;
'DEFAULT/compute_monitors': value => join(any2array($compute_monitors), ','); 'DEFAULT/compute_monitors': value => join(any2array($compute_monitors), ',');
'DEFAULT/default_ephemeral_format': value => $default_ephemeral_format; 'DEFAULT/default_ephemeral_format': value => $default_ephemeral_format;
'compute/image_type_exclude_list': value => $image_type_exclude_list_real;
} }
if ($vnc_enabled) { if ($vnc_enabled) {

View File

@@ -0,0 +1,5 @@
---
features:
- |
Add the ``image_type_exclude_list`` parameter to prevent the compute
service advertising support for specific image types.

View File

@@ -70,6 +70,7 @@ describe 'nova::compute' do
it { is_expected.to contain_nova_config('DEFAULT/running_deleted_instance_timeout').with_value('<SERVICE DEFAULT>') } it { is_expected.to contain_nova_config('DEFAULT/running_deleted_instance_timeout').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('DEFAULT/compute_monitors').with_value('<SERVICE DEFAULT>') } it { is_expected.to contain_nova_config('DEFAULT/compute_monitors').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('DEFAULT/default_ephemeral_format').with_value('<SERVICE DEFAULT>') } it { is_expected.to contain_nova_config('DEFAULT/default_ephemeral_format').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('compute/image_type_exclude_list').with_value('<SERVICE DEFAULT>') }
it { is_expected.to_not contain_package('bridge-utils').with( it { is_expected.to_not contain_package('bridge-utils').with(
:ensure => 'present', :ensure => 'present',
@@ -129,6 +130,7 @@ describe 'nova::compute' do
:running_deleted_instance_timeout => '200', :running_deleted_instance_timeout => '200',
:compute_monitors => ['cpu.virt_driver','fake'], :compute_monitors => ['cpu.virt_driver','fake'],
:default_ephemeral_format => 'ext4', :default_ephemeral_format => 'ext4',
:image_type_exclude_list => ['raw','ami'],
} }
end end
@@ -194,6 +196,7 @@ describe 'nova::compute' do
it { is_expected.to contain_nova_config('DEFAULT/running_deleted_instance_timeout').with_value('200') } it { is_expected.to contain_nova_config('DEFAULT/running_deleted_instance_timeout').with_value('200') }
it { is_expected.to contain_nova_config('DEFAULT/compute_monitors').with_value('cpu.virt_driver,fake') } it { is_expected.to contain_nova_config('DEFAULT/compute_monitors').with_value('cpu.virt_driver,fake') }
it { is_expected.to contain_nova_config('DEFAULT/default_ephemeral_format').with_value('ext4') } it { is_expected.to contain_nova_config('DEFAULT/default_ephemeral_format').with_value('ext4') }
it { is_expected.to contain_nova_config('compute/image_type_exclude_list').with_value('raw,ami') }
it 'configures nova config_drive_format to vfat' do it 'configures nova config_drive_format to vfat' do
is_expected.to contain_nova_config('DEFAULT/config_drive_format').with_value('vfat') is_expected.to contain_nova_config('DEFAULT/config_drive_format').with_value('vfat')
@@ -203,6 +206,15 @@ describe 'nova::compute' do
end end
end end
context 'with image_type_exclude_list set to empty list' do
let :params do
{
:image_type_exclude_list => []
}
end
it { is_expected.to contain_nova_config('compute/image_type_exclude_list').with_value('<SERVICE DEFAULT>') }
end
context 'with reserved_huge_pages string' do context 'with reserved_huge_pages string' do
let :params do let :params do
{ {