From f581b7eaff7457eda3adb30d2361351c6b5bbf8c Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Wed, 1 Nov 2023 15:23:31 +0900 Subject: [PATCH] Add support for [compute] reserved_host_cpus Change-Id: I7b30d1ad19c1a950c14171bc2a150d9ab8ead248 --- manifests/compute.pp | 12 ++++++++---- .../notes/reserved_host_cpus-7a2c7ed3047834c2.yaml | 4 ++++ spec/classes/nova_compute_spec.rb | 11 +++++++---- 3 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 releasenotes/notes/reserved_host_cpus-7a2c7ed3047834c2.yaml diff --git a/manifests/compute.pp b/manifests/compute.pp index bbc8488df..f441a7b68 100644 --- a/manifests/compute.pp +++ b/manifests/compute.pp @@ -80,14 +80,16 @@ # The format is = # Defaults to $facts['os_service_default'] # +# [*reserved_host_cpus*] +# (optional) Number of host CPUs reserved for the host. +# Defaults to $facts['os_service_default'] +# # [*reserved_host_memory*] -# Reserved host memory -# The amount of memory in MB reserved for the host. +# (optional) The amount of memory in MB reserved for the host. # Defaults to $facts['os_service_default'] # # [*reserved_host_disk*] -# Reserved host disk -# The amount of disk in MB reserved for the host. +# (optional) The amount of disk in MB reserved for the host. # Defaults to $facts['os_service_default'] # # [*config_drive_format*] @@ -271,6 +273,7 @@ class nova::compute ( $use_cow_images = $facts['os_service_default'], $force_raw_images = $facts['os_service_default'], $virt_mkfs = $facts['os_service_default'], + $reserved_host_cpus = $facts['os_service_default'], $reserved_host_memory = $facts['os_service_default'], $reserved_host_disk = $facts['os_service_default'], $heal_instance_info_cache_interval = $facts['os_service_default'], @@ -376,6 +379,7 @@ class nova::compute ( 'DEFAULT/mkisofs_cmd': value => $mkisofs_cmd_real; 'DEFAULT/force_raw_images': value => $force_raw_images; 'DEFAULT/virt_mkfs': value => $virt_mkfs; + 'DEFAULT/reserved_host_cpus': value => $reserved_host_cpus; 'DEFAULT/reserved_host_memory_mb': value => $reserved_host_memory; 'DEFAULT/reserved_host_disk_mb': value => $reserved_host_disk; 'DEFAULT/reserved_huge_pages': value => $reserved_huge_pages_real; diff --git a/releasenotes/notes/reserved_host_cpus-7a2c7ed3047834c2.yaml b/releasenotes/notes/reserved_host_cpus-7a2c7ed3047834c2.yaml new file mode 100644 index 000000000..d8d6d7449 --- /dev/null +++ b/releasenotes/notes/reserved_host_cpus-7a2c7ed3047834c2.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + The new ``nova::compute::reserved_host_cpus`` parameter has been added. diff --git a/spec/classes/nova_compute_spec.rb b/spec/classes/nova_compute_spec.rb index 49e72b3e7..3a8ba2bfd 100644 --- a/spec/classes/nova_compute_spec.rb +++ b/spec/classes/nova_compute_spec.rb @@ -38,6 +38,7 @@ describe 'nova::compute' do it { is_expected.to contain_nova_config('DEFAULT/mkisofs_cmd').with_value(platform_params[:mkisofs_cmd]) } it { is_expected.to contain_nova_config('DEFAULT/force_raw_images').with_value('') } it { is_expected.to contain_nova_config('DEFAULT/virt_mkfs').with_value('') } + it { is_expected.to contain_nova_config('DEFAULT/reserved_host_cpus').with_value('') } it { is_expected.to contain_nova_config('DEFAULT/reserved_host_memory_mb').with_value('') } it { is_expected.to contain_nova_config('DEFAULT/reserved_host_disk_mb').with_value('') } it { is_expected.to contain_nova_config('DEFAULT/reserved_huge_pages').with_value('') } @@ -92,8 +93,9 @@ describe 'nova::compute' do :mkisofs_cmd => 'mkisofs', :force_raw_images => false, :virt_mkfs => 'windows=mkfs.ntfs --force --fast %(target)s', - :reserved_host_memory => '0', - :reserved_host_disk => '20', + :reserved_host_cpus => 2, + :reserved_host_memory => 0, + :reserved_host_disk => 20, :heal_instance_info_cache_interval => '120', :config_drive_format => 'vfat', :update_resources_interval => '300', @@ -153,8 +155,9 @@ describe 'nova::compute' do it { is_expected.to contain_nova_config('DEFAULT/mkisofs_cmd').with_value('mkisofs') } it { is_expected.to contain_nova_config('DEFAULT/force_raw_images').with_value(false) } it { is_expected.to contain_nova_config('DEFAULT/virt_mkfs').with_value('windows=mkfs.ntfs --force --fast %(target)s') } - it { is_expected.to contain_nova_config('DEFAULT/reserved_host_memory_mb').with_value('0') } - it { is_expected.to contain_nova_config('DEFAULT/reserved_host_disk_mb').with_value('20') } + it { is_expected.to contain_nova_config('DEFAULT/reserved_host_cpus').with_value(2) } + it { is_expected.to contain_nova_config('DEFAULT/reserved_host_memory_mb').with_value(0) } + it { is_expected.to contain_nova_config('DEFAULT/reserved_host_disk_mb').with_value(20) } it { is_expected.to contain_nova_config('DEFAULT/heal_instance_info_cache_interval').with_value('120') } it { is_expected.to contain_nova_config('DEFAULT/update_resources_interval').with_value('300') } it { is_expected.to contain_nova_config('DEFAULT/reboot_timeout').with_value('180') }