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
This commit is contained in:
Martin Schuppert 2018-06-14 16:27:53 +02:00
parent ab23e15292
commit 9466b13f1b
3 changed files with 33 additions and 0 deletions

View File

@ -114,6 +114,12 @@
# for virtual machine processes # for virtual machine processes
# Defaults to $::os_service_default # 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*] # [*resume_guests_state_on_host_boot*]
# (optional) This option specifies whether to start guests that were running before the # (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 # 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, $allow_resize_to_same_host = false,
$resize_confirm_window = $::os_service_default, $resize_confirm_window = $::os_service_default,
$vcpu_pin_set = $::os_service_default, $vcpu_pin_set = $::os_service_default,
$cpu_shared_set = $::os_service_default,
$resume_guests_state_on_host_boot = $::os_service_default, $resume_guests_state_on_host_boot = $::os_service_default,
$barbican_auth_endpoint = $::os_service_default, $barbican_auth_endpoint = $::os_service_default,
$barbican_endpoint = $::os_service_default, $barbican_endpoint = $::os_service_default,
@ -206,6 +213,7 @@ class nova::compute (
include ::nova::params include ::nova::params
$vcpu_pin_set_real = pick(join(any2array($vcpu_pin_set), ','), $::os_service_default) $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 include ::nova::pci
@ -247,6 +255,7 @@ class nova::compute (
'DEFAULT/resize_confirm_window': value => $resize_confirm_window; 'DEFAULT/resize_confirm_window': value => $resize_confirm_window;
'DEFAULT/vcpu_pin_set': value => $vcpu_pin_set_real; 'DEFAULT/vcpu_pin_set': value => $vcpu_pin_set_real;
'DEFAULT/resume_guests_state_on_host_boot': value => $resume_guests_state_on_host_boot; '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; 'key_manager/backend': value => $keymgr_backend_real;
'barbican/auth_endpoint': value => $barbican_auth_endpoint; 'barbican/auth_endpoint': value => $barbican_auth_endpoint;
'barbican/barbican_endpoint': value => $barbican_endpoint; 'barbican/barbican_endpoint': value => $barbican_endpoint;

View File

@ -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.

View File

@ -28,6 +28,7 @@ describe 'nova::compute' do
it { is_expected.to contain_nova_config('DEFAULT/resize_confirm_window').with_value('<SERVICE DEFAULT>') } it { is_expected.to contain_nova_config('DEFAULT/resize_confirm_window').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('DEFAULT/vcpu_pin_set').with(:value => '<SERVICE DEFAULT>') } it { is_expected.to contain_nova_config('DEFAULT/vcpu_pin_set').with(:value => '<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('DEFAULT/resume_guests_state_on_host_boot').with_value('<SERVICE DEFAULT>') } it { is_expected.to contain_nova_config('DEFAULT/resume_guests_state_on_host_boot').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_nova_config('compute/cpu_shared_set').with(:value => '<SERVICE DEFAULT>') }
it { is_expected.to_not contain_nova_config('vnc/novncproxy_base_url') } 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('key_manager/backend').with_value('nova.keymgr.conf_key_mgr.ConfKeyManager') }
it { is_expected.to contain_nova_config('barbican/barbican_endpoint').with_value('<SERVICE DEFAULT>') } it { is_expected.to contain_nova_config('barbican/barbican_endpoint').with_value('<SERVICE DEFAULT>') }
@ -75,6 +76,7 @@ describe 'nova::compute' do
:config_drive_format => 'vfat', :config_drive_format => 'vfat',
:resize_confirm_window => '3', :resize_confirm_window => '3',
:vcpu_pin_set => ['4-12','^8','15'], :vcpu_pin_set => ['4-12','^8','15'],
:cpu_shared_set => ['4-12','^8','15'],
:resume_guests_state_on_host_boot => true, :resume_guests_state_on_host_boot => true,
:keymgr_backend => 'castellan.key_manager.barbican_key_manager.BarbicanKeyManager', :keymgr_backend => 'castellan.key_manager.barbican_key_manager.BarbicanKeyManager',
:barbican_endpoint => 'http://localhost', :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('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('DEFAULT/max_concurrent_live_migrations').with_value('4') }
it { is_expected.to contain_nova_config('compute/consecutive_build_service_disable_threshold').with_value('9') } 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
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 => '<SERVICE DEFAULT>')
end
end
context 'with neutron_enabled set to false' do context 'with neutron_enabled set to false' do
let :params do let :params do
{ :neutron_enabled => false } { :neutron_enabled => false }