diff --git a/ansible/group_vars/all/compute b/ansible/group_vars/all/compute index 92d32b336..dba12a943 100644 --- a/ansible/group_vars/all/compute +++ b/ansible/group_vars/all/compute @@ -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. diff --git a/ansible/group_vars/all/controllers b/ansible/group_vars/all/controllers index f0322b885..17c32078a 100644 --- a/ansible/group_vars/all/controllers +++ b/ansible/group_vars/all/controllers @@ -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. diff --git a/ansible/group_vars/all/infra-vms b/ansible/group_vars/all/infra-vms index aa9e19e1d..8674b3ece 100644 --- a/ansible/group_vars/all/infra-vms +++ b/ansible/group_vars/all/infra-vms @@ -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. diff --git a/ansible/group_vars/all/monitoring b/ansible/group_vars/all/monitoring index e4315cbcd..b3c4c7219 100644 --- a/ansible/group_vars/all/monitoring +++ b/ansible/group_vars/all/monitoring @@ -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. diff --git a/ansible/group_vars/all/seed b/ansible/group_vars/all/seed index 507132293..c0bd77ae4 100644 --- a/ansible/group_vars/all/seed +++ b/ansible/group_vars/all/seed @@ -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. diff --git a/ansible/group_vars/all/seed-hypervisor b/ansible/group_vars/all/seed-hypervisor index 711b4cf76..1c1662f32 100644 --- a/ansible/group_vars/all/seed-hypervisor +++ b/ansible/group_vars/all/seed-hypervisor @@ -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. diff --git a/ansible/group_vars/all/storage b/ansible/group_vars/all/storage index eabaa41fa..15919365e 100644 --- a/ansible/group_vars/all/storage +++ b/ansible/group_vars/all/storage @@ -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. diff --git a/ansible/group_vars/compute/tuned b/ansible/group_vars/compute/tuned new file mode 100644 index 000000000..3817d5112 --- /dev/null +++ b/ansible/group_vars/compute/tuned @@ -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 }}" diff --git a/ansible/group_vars/controllers/tuned b/ansible/group_vars/controllers/tuned new file mode 100644 index 000000000..9bbca8fd2 --- /dev/null +++ b/ansible/group_vars/controllers/tuned @@ -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 }}" diff --git a/ansible/group_vars/infra-vms/tuned b/ansible/group_vars/infra-vms/tuned new file mode 100644 index 000000000..d34b5c190 --- /dev/null +++ b/ansible/group_vars/infra-vms/tuned @@ -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 }}" diff --git a/ansible/group_vars/monitoring/tuned b/ansible/group_vars/monitoring/tuned new file mode 100644 index 000000000..0052314ae --- /dev/null +++ b/ansible/group_vars/monitoring/tuned @@ -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 }} diff --git a/ansible/group_vars/seed-hypervisor/tuned b/ansible/group_vars/seed-hypervisor/tuned new file mode 100644 index 000000000..dff0931bb --- /dev/null +++ b/ansible/group_vars/seed-hypervisor/tuned @@ -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 }}" diff --git a/ansible/group_vars/seed/tuned b/ansible/group_vars/seed/tuned new file mode 100644 index 000000000..1a22c74c1 --- /dev/null +++ b/ansible/group_vars/seed/tuned @@ -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 }}" diff --git a/ansible/group_vars/storage/tuned b/ansible/group_vars/storage/tuned new file mode 100644 index 000000000..305f1045e --- /dev/null +++ b/ansible/group_vars/storage/tuned @@ -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 }}" diff --git a/ansible/tuned.yml b/ansible/tuned.yml new file mode 100644 index 000000000..9553da7c7 --- /dev/null +++ b/ansible/tuned.yml @@ -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' diff --git a/doc/source/configuration/reference/hosts.rst b/doc/source/configuration/reference/hosts.rst index 1203e6fa0..946787119 100644 --- a/doc/source/configuration/reference/hosts.rst +++ b/doc/source/configuration/reference/hosts.rst @@ -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:* diff --git a/etc/kayobe/compute.yml b/etc/kayobe/compute.yml index af8d35a8f..cd0ceb247 100644 --- a/etc/kayobe/compute.yml +++ b/etc/kayobe/compute.yml @@ -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. diff --git a/etc/kayobe/controllers.yml b/etc/kayobe/controllers.yml index 62a1524aa..983251c6c 100644 --- a/etc/kayobe/controllers.yml +++ b/etc/kayobe/controllers.yml @@ -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. diff --git a/etc/kayobe/infra-vms.yml b/etc/kayobe/infra-vms.yml index c4dedb8aa..4fb9cc162 100644 --- a/etc/kayobe/infra-vms.yml +++ b/etc/kayobe/infra-vms.yml @@ -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. diff --git a/etc/kayobe/monitoring.yml b/etc/kayobe/monitoring.yml index b1018a364..f332ab938 100644 --- a/etc/kayobe/monitoring.yml +++ b/etc/kayobe/monitoring.yml @@ -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. diff --git a/etc/kayobe/seed-hypervisor.yml b/etc/kayobe/seed-hypervisor.yml index 792432b28..26cfbe594 100644 --- a/etc/kayobe/seed-hypervisor.yml +++ b/etc/kayobe/seed-hypervisor.yml @@ -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. diff --git a/etc/kayobe/seed.yml b/etc/kayobe/seed.yml index cd3e30113..3a5186ea6 100644 --- a/etc/kayobe/seed.yml +++ b/etc/kayobe/seed.yml @@ -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. diff --git a/etc/kayobe/storage.yml b/etc/kayobe/storage.yml index 7aa0d48e9..535666c95 100644 --- a/etc/kayobe/storage.yml +++ b/etc/kayobe/storage.yml @@ -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. diff --git a/kayobe/cli/commands.py b/kayobe/cli/commands.py index 0ceeb39e3..d00d60022 100644 --- a/kayobe/cli/commands.py +++ b/kayobe/cli/commands.py @@ -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") diff --git a/kayobe/tests/unit/cli/test_commands.py b/kayobe/tests/unit/cli/test_commands.py index fb207a568..a20739948 100644 --- a/kayobe/tests/unit/cli/test_commands.py +++ b/kayobe/tests/unit/cli/test_commands.py @@ -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( diff --git a/playbooks/kayobe-overcloud-host-configure-base/tests/test_overcloud_host_configure.py b/playbooks/kayobe-overcloud-host-configure-base/tests/test_overcloud_host_configure.py index 0ec0d01db..ebe615056 100644 --- a/playbooks/kayobe-overcloud-host-configure-base/tests/test_overcloud_host_configure.py +++ b/playbooks/kayobe-overcloud-host-configure-base/tests/test_overcloud_host_configure.py @@ -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 diff --git a/releasenotes/notes/tuned-86e2a6519b644985.yaml b/releasenotes/notes/tuned-86e2a6519b644985.yaml new file mode 100644 index 000000000..b8f8b57dd --- /dev/null +++ b/releasenotes/notes/tuned-86e2a6519b644985.yaml @@ -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. diff --git a/releasenotes/notes/tuned-default-profiles-7c795b9599856aee.yaml b/releasenotes/notes/tuned-default-profiles-7c795b9599856aee.yaml new file mode 100644 index 000000000..5e7293a04 --- /dev/null +++ b/releasenotes/notes/tuned-default-profiles-7c795b9599856aee.yaml @@ -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 + `_ + and `story 2007853 `__ + for details. diff --git a/requirements.yml b/requirements.yml index 2c6e8707d..e3f2078bc 100644 --- a/requirements.yml +++ b/requirements.yml @@ -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