Add support for configuring tuned profile

This is only supported on CentOS for now due to limitations of the
Ansible role used to configure tuned.

Change-Id: Ie07c5f467975f8da2f720e70c94cea6285981d72
Co-Authored-By: Pierre Riteau <pierre@stackhpc.com>
Story: 2007853
Task: 40155
This commit is contained in:
Michał Nasiadka 2021-09-28 16:00:52 +02:00 committed by Pierre Riteau
parent 4b31079fae
commit 769c2efb97
29 changed files with 236 additions and 5 deletions

View File

@ -127,6 +127,13 @@ compute_lvm_group_data_lv_docker_volumes_fs: ext4
# Dict of sysctl parameters to set.
compute_sysctl_parameters: {}
###############################################################################
# Compute node tuned configuration.
# Builtin tuned profile to use. Format is same as that used by giovtorres.tuned
# role. Default is virtual-host.
compute_tuned_active_builtin_profile: "virtual-host"
###############################################################################
# Compute node user configuration.

View File

@ -149,6 +149,13 @@ controller_lvm_group_data_lv_docker_volumes_fs: ext4
# Dict of sysctl parameters to set.
controller_sysctl_parameters: {}
###############################################################################
# Controller node tuned configuration.
# Builtin tuned profile to use. Format is same as that used by giovtorres.tuned
# role. Default is throughput-performance.
controller_tuned_active_builtin_profile: "throughput-performance"
###############################################################################
# Controller node user configuration.

View File

@ -165,6 +165,13 @@ infra_vm_lvm_group_data_lv_docker_volumes_fs: ext4
# Dict of sysctl parameters to set.
infra_vm_sysctl_parameters: {}
###############################################################################
# Infrastructure VM node tuned configuration.
# Builtin tuned profile to use. Format is same as that used by giovtorres.tuned
# role. Default is virtual-guest.
infra_vm_tuned_active_builtin_profile: "virtual-guest"
###############################################################################
# Infrastructure VM node user configuration.

View File

@ -88,6 +88,13 @@ monitoring_lvm_groups_extra: "{{ controller_lvm_groups_extra }}"
# Dict of sysctl parameters to set.
monitoring_sysctl_parameters: "{{ controller_sysctl_parameters }}"
###############################################################################
# Monitoring node tuned configuration.
# Builtin tuned profile to use. Format is same as that used by giovtorres.tuned
# role. Default is throughput-performance.
monitoring_tuned_active_builtin_profile: "throughput-performance"
###############################################################################
# Monitoring node user configuration.

View File

@ -96,6 +96,13 @@ seed_lvm_group_data_lv_docker_volumes_fs: ext4
# Dict of sysctl parameters to set.
seed_sysctl_parameters: {}
###############################################################################
# Seed node tuned configuration.
# Builtin tuned profile to use. Format is same as that used by giovtorres.tuned
# role. Default is virtual-guest.
seed_tuned_active_builtin_profile: "virtual-guest"
###############################################################################
# Seed node user configuration.

View File

@ -122,6 +122,13 @@ seed_hypervisor_libvirt_networks: >
# Dict of sysctl parameters to set.
seed_hypervisor_sysctl_parameters: {}
###############################################################################
# Seed hypervisor tuned configuration.
# Builtin tuned profile to use. Format is same as that used by giovtorres.tuned
# role. Default is virtual-host.
seed_hypervisor_tuned_active_builtin_profile: "virtual-host"
###############################################################################
# Seed hypervisor user configuration.

View File

@ -139,6 +139,13 @@ storage_lvm_group_data_lv_docker_volumes_fs: ext4
# Dict of sysctl parameters to set.
storage_sysctl_parameters: {}
###############################################################################
# Storage node tuned configuration.
# Builtin tuned profile to use. Format is same as that used by giovtorres.tuned
# role. Default is throughput-performance.
storage_tuned_active_builtin_profile: "throughput-performance"
###############################################################################
# Storage node user configuration.

View File

@ -0,0 +1,7 @@
---
###############################################################################
# Compute node tuned configuration.
# Builtin tuned profile to use. Format is same as that used by giovtorres.tuned
# role.
tuned_active_builtin_profile: "{{ compute_tuned_active_builtin_profile }}"

View File

@ -0,0 +1,7 @@
---
###############################################################################
# Controller node tuned configuration.
# Builtin tuned profile to use. Format is same as that used by giovtorres.tuned
# role.
tuned_active_builtin_profile: "{{ controller_tuned_active_builtin_profile }}"

View File

@ -0,0 +1,7 @@
---
###############################################################################
# Infrastructure VM node tuned configuration.
# Builtin tuned profile to use. Format is same as that used by giovtorres.tuned
# role.
tuned_active_builtin_profile: "{{ infra_vm_tuned_active_builtin_profile }}"

View File

@ -0,0 +1,10 @@
---
###############################################################################
# Monitoring node tuned configuration.
# Builtin tuned profile to use. Format is same as that used by giovtorres.tuned
# role.
tuned_active_builtin_profile: >
{{ controller_tuned_active_builtin_profile
if inventory_hostname in groups['controllers'] else
monitoring_tuned_active_builtin_profile }}

View File

@ -0,0 +1,7 @@
---
###############################################################################
# Seed hypervisor tuned configuration.
# Builtin tuned profile to use. Format is same as that used by giovtorres.tuned
# role.
tuned_active_builtin_profile: "{{ seed_hypervisor_tuned_active_builtin_profile }}"

View File

@ -0,0 +1,7 @@
---
###############################################################################
# Seed node tuned configuration.
# Builtin tuned profile to use. Format is same as that used by giovtorres.tuned
# role.
tuned_active_builtin_profile: "{{ seed_tuned_active_builtin_profile }}"

View File

@ -0,0 +1,7 @@
---
###############################################################################
# Storage node tuned configuration.
# Builtin tuned profile to use. Format is same as that used by giovtorres.tuned
# role.
tuned_active_builtin_profile: "{{ storage_tuned_active_builtin_profile }}"

11
ansible/tuned.yml Normal file
View File

@ -0,0 +1,11 @@
---
- name: Configure tuned profile
hosts: seed:seed-hypervisor:overcloud:infra-vms
tags:
- tuned
roles:
- name: giovtorres.tuned
become: true
when:
- tuned_active_builtin_profile != ""
- ansible_facts.os_family == 'RedHat'

View File

@ -428,6 +428,45 @@ In the following example, firewalld is enabled on controllers. ``public`` and
- service: http
zone: public
.. _configuration-hosts-tuned:
Tuned
=====
*tags:*
| ``tuned``
.. note:: Tuned configuration only supports CentOS systems for now.
Built-in ``tuned`` profiles can be applied to hosts. The following variables
can be used to set a ``tuned`` profile to specific types of hosts:
* ``seed_hypervisor_tuned_active_builtin_profile``
* ``seed_tuned_active_builtin_profile``
* ``compute_tuned_active_builtin_profile``
* ``controller_tuned_active_builtin_profile``
* ``monitoring_tuned_active_builtin_profile``
* ``storage_tuned_active_builtin_profile``
* ``infra_vm_tuned_active_builtin_profile``
By default, Kayobe applies a ``tuned`` profile matching the role of each host
in the system:
* seed hypervisor: ``virtual-host``
* seed: ``virtual-guest``
* infrastructure VM: ``virtual-guest``
* compute: ``virtual-host``
* controllers: ``throughput-performance``
* monitoring: ``throughput-performance``
* storage: ``throughput-performance``
For example, to change the ``tuned`` profile of controllers to
``network-throughput``:
.. code-block:: yaml
:caption: ``controllers.yml``
controller_tuned_active_builtin_profile: network-throughput
Sysctls
=======
*tags:*

View File

@ -108,6 +108,13 @@
# Dict of sysctl parameters to set.
#compute_sysctl_parameters:
###############################################################################
# Compute node tuned configuration.
# Builtin tuned profile to use. Format is same as that used by giovtorres.tuned
# role. Default is virtual-host.
#compute_tuned_active_builtin_profile:
###############################################################################
# Compute node user configuration.

View File

@ -117,6 +117,13 @@
# Dict of sysctl parameters to set.
#controller_sysctl_parameters:
###############################################################################
# Controller node tuned configuration.
# Builtin tuned profile to use. Format is same as that used by giovtorres.tuned
# role. Default is throughput-performance.
#controller_tuned_active_builtin_profile:
###############################################################################
# Controller node user configuration.

View File

@ -134,6 +134,13 @@
# Dict of sysctl parameters to set.
#infra_vm_sysctl_parameters:
###############################################################################
# Infrastructure VM node tuned configuration.
# Builtin tuned profile to use. Format is same as that used by giovtorres.tuned
# role. Default is virtual-guest.
#infra_vm_tuned_active_builtin_profile:
###############################################################################
# Infrastructure VM node user configuration.

View File

@ -81,6 +81,13 @@
# Dict of sysctl parameters to set.
#monitoring_sysctl_parameters:
###############################################################################
# Monitoring node tuned configuration.
# Builtin tuned profile to use. Format is same as that used by giovtorres.tuned
# role. Default is throughput-performance.
#monitoring_tuned_active_builtin_profile:
###############################################################################
# Monitoring node user configuration.

View File

@ -97,6 +97,13 @@
# Dict of sysctl parameters to set.
#seed_hypervisor_sysctl_parameters:
###############################################################################
# Seed hypervisor tuned configuration.
# Builtin tuned profile to use. Format is same as that used by giovtorres.tuned
# role. Default is virtual-host.
#seed_hypervisor_tuned_active_builtin_profile:
###############################################################################
# Seed hypervisor user configuration.

View File

@ -79,6 +79,13 @@
# Dict of sysctl parameters to set.
#seed_sysctl_parameters:
###############################################################################
# Seed node tuned configuration.
# Builtin tuned profile to use. Format is same as that used by giovtorres.tuned
# role. Default is virtual-guest.
#seed_tuned_active_builtin_profile:
###############################################################################
# Seed node user configuration.

View File

@ -113,6 +113,13 @@
# Dict of sysctl parameters to set.
#storage_sysctl_parameters:
###############################################################################
# Storage node tuned configuration.
# Builtin tuned profile to use. Format is same as that used by giovtorres.tuned
# role. Default is throughput-performance.
#storage_tuned_active_builtin_profile:
###############################################################################
# Storage node user configuration.

View File

@ -416,6 +416,7 @@ class SeedHypervisorHostConfigure(KollaAnsibleMixin, KayobeAnsibleMixin,
* Configure user accounts, group associations, and authorised SSH keys.
* Configure the host's network interfaces.
* Configure a firewall.
* Configure tuned profile.
* Set sysctl parameters.
* Configure timezone and ntp.
* Optionally, configure software RAID arrays.
@ -456,8 +457,8 @@ class SeedHypervisorHostConfigure(KollaAnsibleMixin, KayobeAnsibleMixin,
if parsed_args.wipe_disks:
playbooks += _build_playbook_list("wipe-disks")
playbooks += _build_playbook_list(
"users", "dev-tools", "network", "firewall", "sysctl", "time",
"mdadm", "luks", "lvm", "seed-hypervisor-libvirt-host")
"users", "dev-tools", "network", "firewall", "tuned", "sysctl",
"time", "mdadm", "luks", "lvm", "seed-hypervisor-libvirt-host")
self.run_kayobe_playbooks(parsed_args, playbooks,
limit="seed-hypervisor")
@ -575,6 +576,7 @@ class SeedHostConfigure(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
* Disable SELinux.
* Configure the host's network interfaces.
* Configure a firewall.
* Configure tuned profile.
* Set sysctl parameters.
* Configure IP routing and source NAT.
* Disable bootstrap interface configuration.
@ -612,7 +614,7 @@ class SeedHostConfigure(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
playbooks += _build_playbook_list("wipe-disks")
playbooks += _build_playbook_list(
"users", "dev-tools", "disable-selinux", "network", "firewall",
"sysctl", "ip-routing", "snat", "disable-glean", "time",
"tuned", "sysctl", "ip-routing", "snat", "disable-glean", "time",
"mdadm", "luks", "lvm", "docker-devicemapper",
"kolla-ansible-user", "kolla-pip", "kolla-target-venv")
self.run_kayobe_playbooks(parsed_args, playbooks, limit="seed")
@ -885,6 +887,7 @@ class InfraVMHostConfigure(KayobeAnsibleMixin, VaultMixin,
* Disable SELinux.
* Configure the host's network interfaces.
* Configure a firewall.
* Configure tuned profile.
* Set sysctl parameters.
* Disable bootstrap interface configuration.
* Configure timezone.
@ -917,7 +920,7 @@ class InfraVMHostConfigure(KayobeAnsibleMixin, VaultMixin,
playbooks += _build_playbook_list("wipe-disks")
playbooks += _build_playbook_list(
"users", "dev-tools", "disable-selinux", "network", "firewall",
"sysctl", "disable-glean", "disable-cloud-init", "time",
"tuned", "sysctl", "disable-glean", "disable-cloud-init", "time",
"mdadm", "luks", "lvm", "docker-devicemapper", "docker")
self.run_kayobe_playbooks(parsed_args, playbooks, limit="infra-vms")
@ -1133,6 +1136,7 @@ class OvercloudHostConfigure(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
* Disable SELinux.
* Configure the host's network interfaces.
* Configure a firewall.
* Configure tuned profile.
* Set sysctl parameters.
* Disable bootstrap interface configuration.
* Configure timezone and ntp.
@ -1168,7 +1172,7 @@ class OvercloudHostConfigure(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
playbooks += _build_playbook_list("wipe-disks")
playbooks += _build_playbook_list(
"users", "dev-tools", "disable-selinux", "network", "firewall",
"sysctl", "disable-glean", "disable-cloud-init", "time",
"tuned", "sysctl", "disable-glean", "disable-cloud-init", "time",
"mdadm", "luks", "lvm", "docker-devicemapper",
"kolla-ansible-user", "kolla-pip", "kolla-target-venv")
self.run_kayobe_playbooks(parsed_args, playbooks, limit="overcloud")

View File

@ -337,6 +337,7 @@ class TestCase(unittest.TestCase):
utils.get_data_files_path("ansible", "dev-tools.yml"),
utils.get_data_files_path("ansible", "network.yml"),
utils.get_data_files_path("ansible", "firewall.yml"),
utils.get_data_files_path("ansible", "tuned.yml"),
utils.get_data_files_path("ansible", "sysctl.yml"),
utils.get_data_files_path("ansible", "time.yml"),
utils.get_data_files_path("ansible", "mdadm.yml"),
@ -511,6 +512,7 @@ class TestCase(unittest.TestCase):
"ansible", "disable-selinux.yml"),
utils.get_data_files_path("ansible", "network.yml"),
utils.get_data_files_path("ansible", "firewall.yml"),
utils.get_data_files_path("ansible", "tuned.yml"),
utils.get_data_files_path("ansible", "sysctl.yml"),
utils.get_data_files_path("ansible", "ip-routing.yml"),
utils.get_data_files_path("ansible", "snat.yml"),
@ -1001,6 +1003,7 @@ class TestCase(unittest.TestCase):
"ansible", "disable-selinux.yml"),
utils.get_data_files_path("ansible", "network.yml"),
utils.get_data_files_path("ansible", "firewall.yml"),
utils.get_data_files_path("ansible", "tuned.yml"),
utils.get_data_files_path("ansible", "sysctl.yml"),
utils.get_data_files_path("ansible", "disable-glean.yml"),
utils.get_data_files_path(
@ -1279,6 +1282,7 @@ class TestCase(unittest.TestCase):
"ansible", "disable-selinux.yml"),
utils.get_data_files_path("ansible", "network.yml"),
utils.get_data_files_path("ansible", "firewall.yml"),
utils.get_data_files_path("ansible", "tuned.yml"),
utils.get_data_files_path("ansible", "sysctl.yml"),
utils.get_data_files_path("ansible", "disable-glean.yml"),
utils.get_data_files_path(

View File

@ -197,3 +197,10 @@ def test_dnf_automatic(host):
assert host.package("dnf-automatic").is_installed
assert host.service("dnf-automatic.timer").is_enabled
assert host.service("dnf-automatic.timer").is_running
@pytest.mark.skipif(not _is_dnf(),
reason="tuned profile setting only supported on CentOS 8")
def test_tuned_profile_is_active(host):
tuned_output = host.check_output("tuned-adm active")
assert "throughput-performance" in tuned_output

View File

@ -0,0 +1,5 @@
---
features:
- |
Adds support for configuring active built-in tuned profile by using the
``giovtorres.tuned`` Ansible role. This is only supported on CentOS.

View File

@ -0,0 +1,9 @@
---
upgrade:
- |
Kayobe now applies a sensible ``tuned`` profile to each host by default.
This may need to be customised, for example if the seed node is not a
virtual machine. See the `documentation
<https://docs.openstack.org/kayobe/latest/configuration/reference/hosts.html#tuned>`_
and `story 2007853 <https://storyboard.openstack.org/#!/story/2007853>`__
for details.

View File

@ -4,6 +4,8 @@ roles:
version: 1.3.1
- src: stackhpc.systemd_networkd
version: v1.0.1
- src: giovtorres.tuned
version: 1.1.0
- src: jriguera.configdrive
# There are no versioned releases of this role.
version: e12d38378ae127c9c61d170fa4ba4729f2c5f2ad