From 614b847449936d16a5b753bc3cfef3c3afea8234 Mon Sep 17 00:00:00 2001 From: Oliver Walsh Date: Mon, 11 Jan 2021 21:42:25 +0000 Subject: [PATCH] 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 --- manifests/compute.pp | 9 +++++++++ ...ute_image_type_exclude_list-8e03916b7e4e4bf6.yaml | 5 +++++ spec/classes/nova_compute_spec.rb | 12 ++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 releasenotes/notes/add_compute_image_type_exclude_list-8e03916b7e4e4bf6.yaml diff --git a/manifests/compute.pp b/manifests/compute.pp index f693c6e6c..c3749ad64 100644 --- a/manifests/compute.pp +++ b/manifests/compute.pp @@ -263,6 +263,11 @@ # on creation. # 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 # # [*neutron_enabled*] @@ -350,6 +355,7 @@ class nova::compute ( $running_deleted_instance_timeout = $::os_service_default, $compute_monitors = $::os_service_default, $default_ephemeral_format = $::os_service_default, + $image_type_exclude_list = $::os_service_default, # DEPRECATED PARAMETERS $neutron_enabled = 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_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( $::nova::compute::ironic::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/compute_monitors': value => join(any2array($compute_monitors), ','); 'DEFAULT/default_ephemeral_format': value => $default_ephemeral_format; + 'compute/image_type_exclude_list': value => $image_type_exclude_list_real; } if ($vnc_enabled) { diff --git a/releasenotes/notes/add_compute_image_type_exclude_list-8e03916b7e4e4bf6.yaml b/releasenotes/notes/add_compute_image_type_exclude_list-8e03916b7e4e4bf6.yaml new file mode 100644 index 000000000..e492bc075 --- /dev/null +++ b/releasenotes/notes/add_compute_image_type_exclude_list-8e03916b7e4e4bf6.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Add the ``image_type_exclude_list`` parameter to prevent the compute + service advertising support for specific image types. diff --git a/spec/classes/nova_compute_spec.rb b/spec/classes/nova_compute_spec.rb index b969b2727..4f8d61622 100644 --- a/spec/classes/nova_compute_spec.rb +++ b/spec/classes/nova_compute_spec.rb @@ -70,6 +70,7 @@ describe 'nova::compute' do it { is_expected.to contain_nova_config('DEFAULT/running_deleted_instance_timeout').with_value('') } it { is_expected.to contain_nova_config('DEFAULT/compute_monitors').with_value('') } it { is_expected.to contain_nova_config('DEFAULT/default_ephemeral_format').with_value('') } + it { is_expected.to contain_nova_config('compute/image_type_exclude_list').with_value('') } it { is_expected.to_not contain_package('bridge-utils').with( :ensure => 'present', @@ -129,6 +130,7 @@ describe 'nova::compute' do :running_deleted_instance_timeout => '200', :compute_monitors => ['cpu.virt_driver','fake'], :default_ephemeral_format => 'ext4', + :image_type_exclude_list => ['raw','ami'], } 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/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('compute/image_type_exclude_list').with_value('raw,ami') } it 'configures nova config_drive_format to vfat' do is_expected.to contain_nova_config('DEFAULT/config_drive_format').with_value('vfat') @@ -203,6 +206,15 @@ describe 'nova::compute' do 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('') } + end + context 'with reserved_huge_pages string' do let :params do {