Browse Source

Merge "Handle kernel boot options"

pull/141/head
mcp-jenkins 7 years ago
parent
commit
e1e4eba9f7
3 changed files with 22 additions and 22 deletions
  1. +12
    -0
      README.rst
  2. +7
    -22
      linux/system/kernel.sls
  3. +3
    -0
      tests/pillar/system.sls

+ 12
- 0
README.rst View File

net.ipv4.tcp_keepalive_time: 30 net.ipv4.tcp_keepalive_time: 30
net.ipv4.tcp_keepalive_probes: 8 net.ipv4.tcp_keepalive_probes: 8


Configure kernel boot options:

.. code-block:: yaml

linux:
system:
kernel:
boot_options:
- elevator=deadline
- spectre_v2=off
- nopti



CPU CPU
~~~ ~~~

+ 7
- 22
linux/system/kernel.sls View File



{%- if system.kernel is defined %} {%- if system.kernel is defined %}


{%- if system.kernel.isolcpu is defined or system.kernel.elevator is defined %}
{%- set kernel_boot_opts = [] %}
{%- do kernel_boot_opts.append('isolcpus=' ~ system.kernel.isolcpu) if system.kernel.isolcpu is defined %}
{%- do kernel_boot_opts.append('elevator=' ~ system.kernel.elevator) if system.kernel.elevator is defined %}
{%- do kernel_boot_opts.extend(system.kernel.boot_options) if system.kernel.boot_options is defined %}


{%- if kernel_boot_opts %}
include: include:
- linux.system.grub - linux.system.grub


{%- if system.kernel.isolcpu is defined %}

/etc/default/grub.d/90-isolcpu.cfg:
file.managed:
- contents: 'GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT isolcpus={{ system.kernel.isolcpu }}"'
- require:
- file: grub_d_directory
{%- if grains.get('virtual_subtype', None) not in ['Docker', 'LXC'] %}
- watch_in:
- cmd: grub_update

{%- endif %}
{%- endif %}

{%- if system.kernel.elevator is defined %}

/etc/default/grub.d/91-elevator.cfg:
/etc/default/grub.d/99-custom-settings.cfg:
file.managed: file.managed:
- contents: 'GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT elevator={{ system.kernel.elevator }}"'
- contents: 'GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT {{ kernel_boot_opts|join(' ') }}"'
- require: - require:
- file: grub_d_directory - file: grub_d_directory
{%- if grains.get('virtual_subtype', None) not in ['Docker', 'LXC'] %} {%- if grains.get('virtual_subtype', None) not in ['Docker', 'LXC'] %}
- watch_in: - watch_in:
- cmd: grub_update - cmd: grub_update

{%- endif %}
{%- endif %} {%- endif %}

{%- endif %} {%- endif %}


{%- if system.kernel.version is defined %} {%- if system.kernel.version is defined %}

+ 3
- 0
tests/pillar/system.sls View File

kernel: kernel:
isolcpu: 1,2,3,4 isolcpu: 1,2,3,4
elevator: deadline elevator: deadline
boot_options:
- pti=off
- spectre_v2=auto
cgroup: cgroup:
group: group:
group_1: group_1:

Loading…
Cancel
Save