From 9466b13f1b7a55e4a22edafdc11f4789d63fd33a Mon Sep 17 00:00:00 2001 From: Martin Schuppert Date: Thu, 14 Jun 2018 16:27:53 +0200 Subject: [PATCH] Allow the cpu_shared_set to be configurable This patch allows puppet-nova to set [compute]/cpu_shared_set. Fixes bug 1776905 Change-Id: I5b15258e3bf6192b0bff71fb080a1db323456a66 --- manifests/compute.pp | 9 +++++++++ .../compute-cpu-shared-set-30e2394d1af2dd47.yaml | 10 ++++++++++ spec/classes/nova_compute_spec.rb | 14 ++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 releasenotes/notes/compute-cpu-shared-set-30e2394d1af2dd47.yaml diff --git a/manifests/compute.pp b/manifests/compute.pp index cb6771ec6..7e3a7f991 100644 --- a/manifests/compute.pp +++ b/manifests/compute.pp @@ -114,6 +114,12 @@ # for virtual machine processes # Defaults to $::os_service_default # +# [*cpu_shared_set*] +# (optional) A list or range of physical CPU cores to reserve +# for for best-effort guest vCPU resources (e.g. emulator threads in +# libvirt/QEMU) +# Defaults to $::os_service_default +# # [*resume_guests_state_on_host_boot*] # (optional) This option specifies whether to start guests that were running before the # host rebooted. It ensures that all of the instances on a Nova compute node @@ -189,6 +195,7 @@ class nova::compute ( $allow_resize_to_same_host = false, $resize_confirm_window = $::os_service_default, $vcpu_pin_set = $::os_service_default, + $cpu_shared_set = $::os_service_default, $resume_guests_state_on_host_boot = $::os_service_default, $barbican_auth_endpoint = $::os_service_default, $barbican_endpoint = $::os_service_default, @@ -206,6 +213,7 @@ class nova::compute ( include ::nova::params $vcpu_pin_set_real = pick(join(any2array($vcpu_pin_set), ','), $::os_service_default) + $cpu_shared_set_real = pick(join(any2array($cpu_shared_set), ','), $::os_service_default) include ::nova::pci @@ -247,6 +255,7 @@ class nova::compute ( 'DEFAULT/resize_confirm_window': value => $resize_confirm_window; 'DEFAULT/vcpu_pin_set': value => $vcpu_pin_set_real; 'DEFAULT/resume_guests_state_on_host_boot': value => $resume_guests_state_on_host_boot; + 'compute/cpu_shared_set': value => $cpu_shared_set_real; 'key_manager/backend': value => $keymgr_backend_real; 'barbican/auth_endpoint': value => $barbican_auth_endpoint; 'barbican/barbican_endpoint': value => $barbican_endpoint; diff --git a/releasenotes/notes/compute-cpu-shared-set-30e2394d1af2dd47.yaml b/releasenotes/notes/compute-cpu-shared-set-30e2394d1af2dd47.yaml new file mode 100644 index 000000000..cc634517f --- /dev/null +++ b/releasenotes/notes/compute-cpu-shared-set-30e2394d1af2dd47.yaml @@ -0,0 +1,10 @@ +--- +features: + - | + Add support for configuring cpu_shared_set + + Some workloads run best when the hypervisor overhead processes (emulator threads in libvirt/QEMU) can be placed on different physical host CPUs than other guest CPU resources. This allow + those workloads to prevent latency spikes for guest vCPU threads. + + To place a workload's emulator threads on a set of isolated physical CPUs, set the configuration option to the set of host CPUs that should be used for best-effort CPU resources. Then set + a flavor extra spec to ``hw:emulator_threads_policy=share`` to instruct nova to place that workload's emulator threads on that set of host CPUs. diff --git a/spec/classes/nova_compute_spec.rb b/spec/classes/nova_compute_spec.rb index ffb6c4f53..ac84c78ec 100644 --- a/spec/classes/nova_compute_spec.rb +++ b/spec/classes/nova_compute_spec.rb @@ -28,6 +28,7 @@ describe 'nova::compute' do it { is_expected.to contain_nova_config('DEFAULT/resize_confirm_window').with_value('') } it { is_expected.to contain_nova_config('DEFAULT/vcpu_pin_set').with(:value => '') } it { is_expected.to contain_nova_config('DEFAULT/resume_guests_state_on_host_boot').with_value('') } + it { is_expected.to contain_nova_config('compute/cpu_shared_set').with(:value => '') } it { is_expected.to_not contain_nova_config('vnc/novncproxy_base_url') } it { is_expected.to contain_nova_config('key_manager/backend').with_value('nova.keymgr.conf_key_mgr.ConfKeyManager') } it { is_expected.to contain_nova_config('barbican/barbican_endpoint').with_value('') } @@ -75,6 +76,7 @@ describe 'nova::compute' do :config_drive_format => 'vfat', :resize_confirm_window => '3', :vcpu_pin_set => ['4-12','^8','15'], + :cpu_shared_set => ['4-12','^8','15'], :resume_guests_state_on_host_boot => true, :keymgr_backend => 'castellan.key_manager.barbican_key_manager.BarbicanKeyManager', :barbican_endpoint => 'http://localhost', @@ -134,6 +136,8 @@ describe 'nova::compute' do it { is_expected.to contain_nova_config('DEFAULT/vcpu_pin_set').with(:value => '4-12,^8,15') } + it { is_expected.to contain_nova_config('compute/cpu_shared_set').with(:value => '4-12,^8,15') } + it { is_expected.to contain_nova_config('DEFAULT/max_concurrent_live_migrations').with_value('4') } it { is_expected.to contain_nova_config('compute/consecutive_build_service_disable_threshold').with_value('9') } @@ -197,6 +201,16 @@ describe 'nova::compute' do end end + context 'when cpu_shared_set is empty' do + let :params do + { :cpu_shared_set => ""} + end + + it 'clears cpu_shared_set configuration' do + is_expected.to contain_nova_config('compute/cpu_shared_set').with(:value => '') + end + end + context 'with neutron_enabled set to false' do let :params do { :neutron_enabled => false }