Add ability to collocate pinned and unpinned instance on same host
Add support for configuring `cpu_dedicated_set` parameter and modify logic for `vcpu_pin_set` and `cpu_shared_set` parameters to add ability to collocate pinned and unpinned instances on same host. Deprecate `vcpu_pin_set` option as it is deprecated from config options in nova [1] as well. [1] https://review.opendev.org/#/c/671793 Change-Id: I40e0ed0bba93bfcdc4cf157195c3e9fbcfce0776
This commit is contained in:
parent
94dc32066f
commit
cf666bd557
@ -96,15 +96,15 @@
|
||||
# server is in resized state longer than that time.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*vcpu_pin_set*]
|
||||
# (optional) A list or range of physical CPU cores to reserve
|
||||
# for virtual machine processes
|
||||
# [*cpu_shared_set*]
|
||||
# (optional) A list or range of host CPU cores to which emulator threads can be
|
||||
# scheduled, if vcpu_pin_set is set, or to which both emulator threads and processes
|
||||
# for unpinned instance CPUs (VCPUs) can be scheduled, if vcpu_pin_set is unset.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*cpu_shared_set*]
|
||||
# (optional) A list or range of physical CPU cores to reserve
|
||||
# for best-effort guest vCPU resources (e.g. emulator threads in
|
||||
# libvirt/QEMU)
|
||||
# [*cpu_dedicated_set*]
|
||||
# (optional) A list or range of host CPU cores to which processes for pinned
|
||||
# instance CPUs (PCPUs) can be scheduled.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*resume_guests_state_on_host_boot*]
|
||||
@ -187,6 +187,16 @@
|
||||
# Applicable only for cases when Neutron was disabled
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*vcpu_pin_set*]
|
||||
# (optional) A list or range of host CPU cores to which processes for
|
||||
# unpinned instance CPUs (VCPUs) can be scheduled, if cpu_shared_set is set,
|
||||
# or to which both emulator threads and processes for unpinned instance CPUs
|
||||
# (VCPUs) can be scheduled, if cpu_shared_set is unset.
|
||||
# This option has been superseded by the ``cpu_shared_set`` and
|
||||
# ``cpu_dedicated_set`` options, which allows co-existence of
|
||||
# pinned and unpinned instances on the same host.
|
||||
# Defaults to undef
|
||||
#
|
||||
class nova::compute (
|
||||
$enabled = true,
|
||||
$manage_service = true,
|
||||
@ -208,8 +218,8 @@ class nova::compute (
|
||||
$config_drive_format = $::os_service_default,
|
||||
$allow_resize_to_same_host = false,
|
||||
$resize_confirm_window = $::os_service_default,
|
||||
$vcpu_pin_set = $::os_service_default,
|
||||
$cpu_shared_set = $::os_service_default,
|
||||
$cpu_dedicated_set = $::os_service_default,
|
||||
$resume_guests_state_on_host_boot = $::os_service_default,
|
||||
$barbican_auth_endpoint = $::os_service_default,
|
||||
$barbican_endpoint = $::os_service_default,
|
||||
@ -228,13 +238,14 @@ class nova::compute (
|
||||
$vnc_keymap = undef,
|
||||
$neutron_enabled = undef,
|
||||
$install_bridge_utils = undef,
|
||||
$vcpu_pin_set = undef,
|
||||
) {
|
||||
|
||||
include ::nova::deps
|
||||
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)
|
||||
$cpu_dedicated_set_real = pick(join(any2array($cpu_dedicated_set), ','), $::os_service_default)
|
||||
|
||||
include ::nova::pci
|
||||
include ::nova::compute::vgpu
|
||||
@ -256,6 +267,43 @@ class nova::compute (
|
||||
fail('vnc_enabled and spice_enabled is mutually exclusive')
|
||||
}
|
||||
|
||||
if $vcpu_pin_set {
|
||||
warning('vcpu_pin_set is deprecated, instead use cpu_dedicated_set or cpu_shared_set.')
|
||||
}
|
||||
|
||||
if !empty($vcpu_pin_set) or $vcpu_pin_set != undef {
|
||||
$vcpu_pin_set_real = join(any2array($vcpu_pin_set), ',')
|
||||
} else {
|
||||
$vcpu_pin_set_real = undef
|
||||
}
|
||||
|
||||
if $vcpu_pin_set_real and !is_service_default($cpu_dedicated_set_real) {
|
||||
fail('vcpu_pin_set is deprecated. vcpu_pin_set and cpu_dedicated_set are mutually exclusive.')
|
||||
}
|
||||
|
||||
if $vcpu_pin_set_real != undef {
|
||||
# handle the following conditions:
|
||||
#
|
||||
# 1. if vcpu_pin_set is set but cpu_shared_set is not set.
|
||||
# 2. if cpu_shared_set and vcpu_pin_set both are set, but cpu_dedicated_set is not set.
|
||||
nova_config {
|
||||
'compute/cpu_shared_set': value => $cpu_shared_set_real;
|
||||
'compute/cpu_dedicated_set': value => $cpu_dedicated_set_real;
|
||||
'compute/vcpu_pin_set': value => $vcpu_pin_set_real;
|
||||
}
|
||||
} else {
|
||||
# handle the following conditions:
|
||||
#
|
||||
# 3. if cpu_dedicated_set is set but cpu_shared_set is not set.
|
||||
# 4. if cpu_shared_set is set but vcpu_pin_set and cpu_dedicated_set are not set.
|
||||
# 5. if cpu_shared_set and cpu_dedicated_set both are set, then ignore vcpu_pin_set.
|
||||
nova_config {
|
||||
'compute/cpu_shared_set': value => $cpu_shared_set_real;
|
||||
'compute/cpu_dedicated_set': value => $cpu_dedicated_set_real;
|
||||
'compute/vcpu_pin_set': ensure => absent; # when undef, don't include in conf.
|
||||
}
|
||||
}
|
||||
|
||||
# cryptsetup is required when Barbican is encrypting volumes
|
||||
if $keymgr_backend =~ /barbican/ {
|
||||
ensure_packages('cryptsetup', {
|
||||
@ -309,9 +357,7 @@ class nova::compute (
|
||||
'DEFAULT/reserved_huge_pages': value => $reserved_huge_pages_real;
|
||||
'DEFAULT/heal_instance_info_cache_interval': value => $heal_instance_info_cache_interval;
|
||||
'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;
|
||||
'barbican/auth_endpoint': value => $barbican_auth_endpoint;
|
||||
'barbican/barbican_endpoint': value => $barbican_endpoint;
|
||||
|
16
releasenotes/notes/cpu-resources-39ce2f92ae6395ae.yaml
Normal file
16
releasenotes/notes/cpu-resources-39ce2f92ae6395ae.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Add new parameter ``[compute] cpu_dedicated_set`` to specify
|
||||
list or range of physical CPU cores to reserve to be used for
|
||||
allocating PCPU resources to virtual machine processes.
|
||||
Defaults to ``$::os_service_default``.
|
||||
deprecations:
|
||||
- |
|
||||
The ``vcpu_pin_set`` parameter is deprecated and superseded by
|
||||
``cpu_shared_set`` and ``cpu_dedicated_set`` parameters, where
|
||||
``cpu_shared_set`` and ``cpu_dedicated_set`` is used to define
|
||||
list or range of VCPU and PCPU resources for virtual machine
|
||||
instances respectively.
|
||||
When used ``vcpu_pin_set`` can not be defined with
|
||||
``cpu_dedicated_set`` parameter.
|
@ -26,9 +26,7 @@ describe 'nova::compute' do
|
||||
|
||||
it { is_expected.to contain_nova_config('DEFAULT/allow_resize_to_same_host').with(:value => 'false') }
|
||||
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/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 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>') }
|
||||
@ -95,8 +93,6 @@ describe 'nova::compute' do
|
||||
:heal_instance_info_cache_interval => '120',
|
||||
: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',
|
||||
@ -156,10 +152,6 @@ describe 'nova::compute' do
|
||||
|
||||
it { is_expected.to contain_nova_config('DEFAULT/resize_confirm_window').with_value('3') }
|
||||
|
||||
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/sync_power_state_pool_size').with_value('10') }
|
||||
@ -207,24 +199,65 @@ describe 'nova::compute' do
|
||||
end
|
||||
end
|
||||
|
||||
context 'when vcpu_pin_set and pci params are empty' do
|
||||
context 'should raise an error, when cpu_dedicated_set and vcpu_pin_set both are defined' do
|
||||
let :params do
|
||||
{ :vcpu_pin_set => ""}
|
||||
{ :vcpu_pin_set => ['4-12','^8','15'],
|
||||
:cpu_dedicated_set => ['4-12','^8','15'], }
|
||||
end
|
||||
|
||||
it 'clears vcpu_pin_set configuration' do
|
||||
is_expected.to contain_nova_config('DEFAULT/vcpu_pin_set').with(:value => '<SERVICE DEFAULT>')
|
||||
end
|
||||
it { should raise_error(Puppet::Error, /vcpu_pin_set is deprecated. vcpu_pin_set and cpu_dedicated_set are mutually exclusive./) }
|
||||
end
|
||||
|
||||
context 'when cpu_shared_set is empty' do
|
||||
context 'when cpu_shared_set and cpu_dedicated_set both are set, but not vcpu_pin_set' do
|
||||
let :params do
|
||||
{ :cpu_shared_set => ""}
|
||||
{ :cpu_shared_set => ['4-12','^8','15'],
|
||||
:cpu_dedicated_set => ['2-10','^5','14'], }
|
||||
end
|
||||
|
||||
it 'clears cpu_shared_set configuration' do
|
||||
is_expected.to contain_nova_config('compute/cpu_shared_set').with(:value => '<SERVICE DEFAULT>')
|
||||
it { is_expected.to contain_nova_config('compute/cpu_shared_set').with(:value => '4-12,^8,15') }
|
||||
it { is_expected.to contain_nova_config('compute/cpu_dedicated_set').with(:value => '2-10,^5,14') }
|
||||
it { is_expected.to contain_nova_config('compute/vcpu_pin_set').with(:ensure => 'absent') }
|
||||
end
|
||||
|
||||
context 'when cpu_dedicated_set is defined but cpu_shared_set is not' do
|
||||
let :params do
|
||||
{ :cpu_dedicated_set => ['4-12','^8','15'] }
|
||||
end
|
||||
|
||||
it { is_expected.to contain_nova_config('compute/cpu_dedicated_set').with(:value => '4-12,^8,15') }
|
||||
it { is_expected.to contain_nova_config('compute/cpu_shared_set').with(:value => '<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_nova_config('compute/vcpu_pin_set').with(:ensure => 'absent') }
|
||||
end
|
||||
|
||||
context 'when cpu_shared_set is defined, but cpu_dedicated_set and vcpu_pin_set are not' do
|
||||
let :params do
|
||||
{ :cpu_shared_set => ['4-12', '^8', '15'] }
|
||||
end
|
||||
|
||||
it { is_expected.to contain_nova_config('compute/cpu_shared_set').with(:value => '4-12,^8,15') }
|
||||
it { is_expected.to contain_nova_config('compute/cpu_dedicated_set').with(:value => '<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_nova_config('compute/vcpu_pin_set').with(:ensure => 'absent') }
|
||||
end
|
||||
|
||||
context 'when cpu_shared_set and vcpu_pin_set are defined, but cpu_dedicated_set is not' do
|
||||
let :params do
|
||||
{ :cpu_shared_set => ['4-12','^8','15'],
|
||||
:vcpu_pin_set => ['2-10','^5','14'], }
|
||||
end
|
||||
|
||||
it { is_expected.to contain_nova_config('compute/cpu_shared_set').with(:value => '4-12,^8,15') }
|
||||
it { is_expected.to contain_nova_config('compute/vcpu_pin_set').with(:value => '2-10,^5,14') }
|
||||
it { is_expected.to contain_nova_config('compute/cpu_dedicated_set').with(:value => '<SERVICE DEFAULT>') }
|
||||
end
|
||||
|
||||
context 'when vcpu_pin_set is set, but cpu_shared_set and cpu_dedicated_set are not' do
|
||||
let :params do
|
||||
{ :vcpu_pin_set => ['4-12','^8','15'] }
|
||||
end
|
||||
|
||||
it { is_expected.to contain_nova_config('compute/vcpu_pin_set').with(:value => '4-12,^8,15') }
|
||||
it { is_expected.to contain_nova_config('compute/cpu_shared_set').with(:value => '<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_nova_config('compute/cpu_dedicated_set').with(:value => '<SERVICE DEFAULT>') }
|
||||
end
|
||||
|
||||
context 'when neutron_physnets_numa_nodes_mapping and neutron_tunnel_numa_nodes are empty' do
|
||||
|
Loading…
Reference in New Issue
Block a user