我正在使用下面的代码来禁用 THP Enabled using puppet
file_line { 'disable-THP-enabled':
ensure => present,
path => '/sys/kernel/mm/transparent_hugepage/enabled',
line => 'never',
}
但我收到以下错误消息:
Error: Could not set 'present' on ensure: Invalid argument - /sys/kernel/mm/transparent_hugepage/enabled at 43:/home/Sandeep_Kanabar/devops/puppet/modules/profile/manifests/setup_os_params.pp
Error: Could not set 'present' on ensure: Invalid argument - /sys/kernel/mm/transparent_hugepage/enabled at 43:/home/Sandeep_Kanabar/devops/puppet/modules/profile/manifests/setup_os_params.pp
Wrapped exception:
Invalid argument - /sys/kernel/mm/transparent_hugepage/enabled
Error: /Stage[main]/Profile::Setup_os_params/File_line[disable-THP-enabled]/ensure: change from absent to present failed: Could not set 'present' on ensure: Invalid argument - /sys/kernel/mm/transparent_hugepage/enabled at 43:/home/Sandeep_Kanabar/devops/puppet/modules/profile/manifests/setup_os_params.pp
这仅在实际启用 THP 时发生。例如
# cat /sys/kernel/mm/transparent_hugepage/enabled
[always] madvise never.
如果禁用 THP,则不会发生此错误。例如
# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]
将 swappiness 设置为 0 时,类似的 puppet 代码会起作用。
file_line { 'set-swappiness':
ensure => present,
path => '/proc/sys/vm/swappiness',
line => '0',
}
有人可以指出我可能遗漏了什么或做错了什么吗?我正在使用独立的木偶版本 3.8.6。这是 CentOS 7.2 上的无主设置