diff --git a/defaults/main.yml b/defaults/main.yml index 5f1e9f9b..c564f361 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -176,6 +176,9 @@ nova_virt_types: # If this is not set, then the playbook will try to guess it. #nova_virt_type: kvm +# Enable Kernel Shared Memory (KSM) +nova_compute_ksm_enabled: False + #if set, nova_virt_type must be one of these: nova_supported_virt_types: - qemu diff --git a/releasenotes/notes/support-ksm-fe6993158768a14e.yaml b/releasenotes/notes/support-ksm-fe6993158768a14e.yaml new file mode 100644 index 00000000..b3349b17 --- /dev/null +++ b/releasenotes/notes/support-ksm-fe6993158768a14e.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Enable Kernel Shared Memory support by setting + ``nova_compute_ksm_enabled`` to ``True``. diff --git a/tasks/drivers/kvm/nova_compute_kvm.yml b/tasks/drivers/kvm/nova_compute_kvm.yml index a7d6619b..6067648c 100644 --- a/tasks/drivers/kvm/nova_compute_kvm.yml +++ b/tasks/drivers/kvm/nova_compute_kvm.yml @@ -119,6 +119,12 @@ tags: - nova-config +- include: nova_enable_ksm.yml + when: + - nova_compute_ksm_enabled | bool + tags: + - nova-config + - include: nova_compute_kvm_virsh_net_remove.yml tags: - nova-config diff --git a/tasks/drivers/kvm/nova_enable_ksm.yml b/tasks/drivers/kvm/nova_enable_ksm.yml new file mode 100644 index 00000000..577d07f3 --- /dev/null +++ b/tasks/drivers/kvm/nova_enable_ksm.yml @@ -0,0 +1,14 @@ +--- +- name: Enable ksm systemd service + service: + name: ksm + enabled: yes + state: started + +- name: Enable ksmtuned systemd service + service: + name: ksmtuned + enabled: yes + state: started + when: + - ansible_pkg_mgr in ['yum', 'dnf', 'apt'] diff --git a/vars/main.yml b/vars/main.yml index bbe03158..49767bc9 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -31,6 +31,9 @@ nova_package_list: |- {% if 'nova_compute' in group_names %} {% if nova_virt_type in ['kvm', 'qemu'] %} {% set _ = packages.extend(nova_compute_kvm_distro_packages) %} + {% if nova_compute_ksm_enabled %} + {% set _ = packages.extend(nova_compute_ksm_packages) %} + {% endif %} {% elif nova_virt_type == 'lxd' %} {% set _ = packages.extend(nova_compute_lxd_distro_packages) %} {% elif nova_virt_type == 'powervm' %} diff --git a/vars/redhat-7.yml b/vars/redhat-7.yml index 50b09175..00e85e27 100644 --- a/vars/redhat-7.yml +++ b/vars/redhat-7.yml @@ -60,6 +60,9 @@ nova_compute_kvm_distro_packages: - qemu-img-ev - sysfsutils +nova_compute_ksm_packages: + - ksmtuned + # TODO: add support for LXD on CentOS at some point. nova_compute_lxd_distro_packages: [] diff --git a/vars/suse-42.yml b/vars/suse-42.yml index 3b103a51..383079ec 100644 --- a/vars/suse-42.yml +++ b/vars/suse-42.yml @@ -53,6 +53,9 @@ nova_compute_kvm_distro_packages: - qemu-tools - sysfsutils +nova_compute_ksm_packages: + - qemu-ksm + # TODO: add support for LXD on openSUSE at some point. nova_compute_lxd_distro_packages: [] diff --git a/vars/ubuntu-16.04.yml b/vars/ubuntu-16.04.yml index 1f20847c..3b55a87d 100644 --- a/vars/ubuntu-16.04.yml +++ b/vars/ubuntu-16.04.yml @@ -101,6 +101,9 @@ nova_compute_powervm_distro_packages: - multipath-tools - pvm-novalink +nova_compute_ksm_packages: + - ksmtuned + novalink_repo: repo: "deb [arch=ppc64el] http://public.dhe.ibm.com/systems/virtualization/Novalink/debian/ novalink_1.0.0 non-free" state: "present"