Add options for CPU power management features

Nova recently introduced the feature to manage pCPU cores performance.
This adds support for these options.

Change-Id: Id1577cf258f29874a5cd1a693025092607bbe9b8
This commit is contained in:
Takashi Kajinami
2023-03-23 11:39:01 +09:00
parent d12c547f5b
commit 7aacf38c1d
3 changed files with 77 additions and 31 deletions

View File

@@ -39,6 +39,22 @@
# to 'none'.
# Defaults to undef
#
# [*cpu_power_management*]
# (optional) Use libvirt to manage CPU cores performance
# Defaults to $::os_service_default
#
# [*cpu_power_management_strategy*]
# (optional) Tuning strategy to reduce CPU power consumption when unused.
# Defaults to $::os_service_default
#
# [*cpu_power_governor_low*]
# (optional) Governor to use in order to reduce CPU power consumption.
# Defaults to $::os_service_default
#
# [*cpu_power_governor_high*]
# (optional) Goernor to use in order to have best CPU performance.
# Defaults to $::os_service_default
#
# [*snapshot_image_format*]
# (optional) Format to save snapshots to. Some filesystems
# have a preference and only operate on raw or qcow2
@@ -250,6 +266,10 @@ class nova::compute::libvirt (
$cpu_mode = false,
$cpu_models = [],
$cpu_model_extra_flags = undef,
$cpu_power_management = $facts['os_service_default'],
$cpu_power_management_strategy = $facts['os_service_default'],
$cpu_power_governor_low = $facts['os_service_default'],
$cpu_power_governor_high = $facts['os_service_default'],
$snapshot_image_format = $facts['os_service_default'],
$snapshots_directory = $facts['os_service_default'],
$disk_cachemodes = [],
@@ -373,6 +393,10 @@ class nova::compute::libvirt (
'vnc/server_listen': value => $vncserver_listen;
'libvirt/virt_type': value => $virt_type;
'libvirt/cpu_mode': value => $cpu_mode_default;
'libvirt/cpu_power_management': value => $cpu_power_management;
'libvirt/cpu_power_management_strategy': value => $cpu_power_management_strategy;
'libvirt/cpu_power_governor_low': value => $cpu_power_governor_low;
'libvirt/cpu_power_governor_high': value => $cpu_power_governor_high;
'libvirt/snapshot_image_format': value => $snapshot_image_format;
'libvirt/snapshots_directory': value => $snapshots_directory;
'libvirt/inject_password': value => $inject_password;

View File

@@ -0,0 +1,10 @@
---
features:
- |
The following parameters have been added to the ``nova::compute::libvirt``
class.
- ``cpu_power_management``
- ``cpu_power_management_strategy``
- ``cpu_power_governor_low``
- ``cpu_power_governor_high``

View File

@@ -51,6 +51,10 @@ describe 'nova::compute::libvirt' do
it { is_expected.to contain_nova_config('libvirt/cpu_mode').with_value('host-model')}
it { is_expected.to contain_nova_config('libvirt/cpu_models').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/cpu_model_extra_flags').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/cpu_power_management').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/cpu_power_management_strategy').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/cpu_power_governor_low').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/cpu_power_governor_high').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/snapshot_image_format').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/snapshots_directory').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/disk_cachemodes').with_ensure('absent')}
@@ -87,6 +91,10 @@ describe 'nova::compute::libvirt' do
:cpu_mode => 'host-passthrough',
:cpu_models => ['kvm64', 'qemu64'],
:cpu_model_extra_flags => 'pcid',
:cpu_power_management => false,
:cpu_power_management_strategy => 'cpu_state',
:cpu_power_governor_low => 'powersave',
:cpu_power_governor_high => 'performance',
:snapshot_image_format => 'raw',
:snapshots_directory => '/var/lib/nova/snapshots',
:disk_cachemodes => ['file=directsync','block=none'],
@@ -134,6 +142,10 @@ describe 'nova::compute::libvirt' do
it { is_expected.to contain_nova_config('libvirt/cpu_mode').with_value('host-passthrough')}
it { is_expected.to contain_nova_config('libvirt/cpu_models').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/cpu_model_extra_flags').with_value('pcid')}
it { is_expected.to contain_nova_config('libvirt/cpu_power_management').with_value(false)}
it { is_expected.to contain_nova_config('libvirt/cpu_power_management_strategy').with_value('cpu_state')}
it { is_expected.to contain_nova_config('libvirt/cpu_power_governor_low').with_value('powersave')}
it { is_expected.to contain_nova_config('libvirt/cpu_power_governor_high').with_value('performance')}
it { is_expected.to contain_nova_config('libvirt/snapshot_image_format').with_value('raw')}
it { is_expected.to contain_nova_config('libvirt/snapshots_directory').with_value('/var/lib/nova/snapshots')}
it { is_expected.to contain_nova_config('libvirt/disk_cachemodes').with_value('file=directsync,block=none')}