Add functionality to manage KSM on compute nodes per role
Adds functionality whether to enable / disable KSM on compute nodes. Especially in NFV use case one wants to disable the service and as there is in general little benefit in overcloud nodes, KSM is disabled per default, but can be enabled using the new NovaComputeEnableKsm role parameter. Change-Id: I1b8dba2e2a9ff4f5ad73a4fbc3251b5dc96fd38e
This commit is contained in:
parent
afe1cb5581
commit
badf39735d
@ -252,6 +252,13 @@ parameters:
|
|||||||
default: false
|
default: false
|
||||||
description: Whether this is an cell additional to the default cell.
|
description: Whether this is an cell additional to the default cell.
|
||||||
type: boolean
|
type: boolean
|
||||||
|
NovaComputeEnableKsm:
|
||||||
|
default: false
|
||||||
|
description: Whether to enable KSM on compute nodes or not. Especially
|
||||||
|
in NFV use case one wants to keep it disabled.
|
||||||
|
type: boolean
|
||||||
|
tags:
|
||||||
|
- role_specific
|
||||||
|
|
||||||
resources:
|
resources:
|
||||||
|
|
||||||
@ -307,6 +314,7 @@ resources:
|
|||||||
nova::compute::libvirt::file_backed_memory: NovaLibvirtFileBackedMemory
|
nova::compute::libvirt::file_backed_memory: NovaLibvirtFileBackedMemory
|
||||||
nova::compute::libvirt::volume_use_multipath: NovaLibvirtVolumeUseMultipath
|
nova::compute::libvirt::volume_use_multipath: NovaLibvirtVolumeUseMultipath
|
||||||
nova::compute::libvirt::libvirt_hw_machine_type: NovaHWMachineType
|
nova::compute::libvirt::libvirt_hw_machine_type: NovaHWMachineType
|
||||||
|
compute_enable_ksm: NovaComputeEnableKsm
|
||||||
- values: {get_param: [RoleParameters]}
|
- values: {get_param: [RoleParameters]}
|
||||||
- values:
|
- values:
|
||||||
NovaVcpuPinSet: {get_param: NovaVcpuPinSet}
|
NovaVcpuPinSet: {get_param: NovaVcpuPinSet}
|
||||||
@ -320,6 +328,7 @@ resources:
|
|||||||
NovaLibvirtFileBackedMemory: {get_param: NovaLibvirtFileBackedMemory}
|
NovaLibvirtFileBackedMemory: {get_param: NovaLibvirtFileBackedMemory}
|
||||||
NovaLibvirtVolumeUseMultipath: {get_param: NovaLibvirtVolumeUseMultipath}
|
NovaLibvirtVolumeUseMultipath: {get_param: NovaLibvirtVolumeUseMultipath}
|
||||||
NovaHWMachineType: {get_param: NovaHWMachineType}
|
NovaHWMachineType: {get_param: NovaHWMachineType}
|
||||||
|
NovaComputeEnableKsm: {get_param: NovaComputeEnableKsm}
|
||||||
|
|
||||||
conditions:
|
conditions:
|
||||||
enable_instance_ha: {equals: [{get_param: EnableInstanceHA}, true]}
|
enable_instance_ha: {equals: [{get_param: EnableInstanceHA}, true]}
|
||||||
@ -663,6 +672,56 @@ outputs:
|
|||||||
- name: If instance HA is enabled on the node activate the evacuation completed check
|
- name: If instance HA is enabled on the node activate the evacuation completed check
|
||||||
file: path=/var/lib/nova/instanceha/enabled state=touch
|
file: path=/var/lib/nova/instanceha/enabled state=touch
|
||||||
when: iha_nodes.stdout|lower | search('"'+ansible_hostname|lower+'"')
|
when: iha_nodes.stdout|lower | search('"'+ansible_hostname|lower+'"')
|
||||||
|
- name: is KSM enabled
|
||||||
|
set_fact:
|
||||||
|
compute_ksm_enabled: {get_attr: [RoleParametersValue, value, compute_enable_ksm]}
|
||||||
|
- name: disable KSM on compute
|
||||||
|
when: not compute_ksm_enabled|bool
|
||||||
|
block:
|
||||||
|
- name: Populate service facts (ksm)
|
||||||
|
service_facts: # needed to make yaml happy
|
||||||
|
- name: disable KSM services
|
||||||
|
service:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: stopped
|
||||||
|
enabled: no
|
||||||
|
with_items:
|
||||||
|
- ksm.service
|
||||||
|
- ksmtuned.service
|
||||||
|
when: "'ksm.service' in ansible_facts.services"
|
||||||
|
register: ksmdisabled
|
||||||
|
# When KSM is disabled, any memory pages that were shared prior to
|
||||||
|
# deactivating KSM are still shared. To delete all of the PageKSM
|
||||||
|
# in the system, we use:
|
||||||
|
- name: delete PageKSM after disable ksm on compute
|
||||||
|
command: echo 2 >/sys/kernel/mm/ksm/run
|
||||||
|
when: ksmdisabled.changed
|
||||||
|
- name: enable KSM on compute
|
||||||
|
when: compute_ksm_enabled|bool
|
||||||
|
block:
|
||||||
|
- name: Populate service facts (ksm)
|
||||||
|
service_facts: # needed to make yaml happy
|
||||||
|
# mschuppert: we can remove the CentOS/RHEL split here when CentOS8/
|
||||||
|
# RHEL8 is available and we have the same package name providing the
|
||||||
|
# KSM services
|
||||||
|
- name: make sure package providing ksmtuned is installed (CentOS)
|
||||||
|
package:
|
||||||
|
name: qemu-kvm-common-ev
|
||||||
|
state: present
|
||||||
|
when: ansible_distribution == 'CentOS'
|
||||||
|
- name: make sure package providing ksmtuned is installed (RHEL)
|
||||||
|
package:
|
||||||
|
name: qemu-kvm-common-rhev
|
||||||
|
state: present
|
||||||
|
when: ansible_distribution == 'RedHat'
|
||||||
|
- name: enable ksmtunded
|
||||||
|
service:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: started
|
||||||
|
enabled: yes
|
||||||
|
with_items:
|
||||||
|
- ksm.service
|
||||||
|
- ksmtuned.service
|
||||||
upgrade_tasks:
|
upgrade_tasks:
|
||||||
- name: Stop nova-compute service
|
- name: Stop nova-compute service
|
||||||
when: step|int == 1
|
when: step|int == 1
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Adds functionality wheter to enable/disable KSM on compute nodes.
|
||||||
|
Especially in NFV use case one wants to disable the service. Because ksm
|
||||||
|
has little benefit in overcloud nodes it gets disabled per default but
|
||||||
|
can be set via NovaComputeEnableKsm.
|
Loading…
Reference in New Issue
Block a user