1 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2 : Copyright (c) 2018 Mirantis Inc., Enea AB and others.
4 : All rights reserved. This program and the accompanying materials
5 : are made available under the terms of the Apache License, Version 2.0
6 : which accompanies this distribution, and is available at
7 : http://www.apache.org/licenses/LICENSE-2.0
8 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
9 From: Michael Polenchuk <mpolenchuk@mirantis.com>
10 Date: Thu, 25 Jan 2018 13:22:39 +0400
11 Subject: [PATCH] Handle kernel boot options
13 The 'system.kernel.elevator' and 'system.kernel.isolcpu' options
14 have been kept for backward compatibility and should be used in new
15 fashion way with system.kernel.boot_options parameter.
17 Change-Id: I51f7167b8b8946500df2065ee6b02bcf21809bc9
19 diff --git a/linux/system/kernel.sls b/linux/system/kernel.sls
20 index 59b7177..b1c3f3b 100644
21 --- a/linux/system/kernel.sls
22 +++ b/linux/system/kernel.sls
25 {%- if system.kernel is defined %}
27 -{%- if system.kernel.isolcpu is defined or system.kernel.elevator is defined %}
28 +{%- set kernel_boot_opts = [] %}
29 +{%- do kernel_boot_opts.append('isolcpus=' ~ system.kernel.isolcpu) if system.kernel.isolcpu is defined %}
30 +{%- do kernel_boot_opts.append('elevator=' ~ system.kernel.elevator) if system.kernel.elevator is defined %}
31 +{%- do kernel_boot_opts.extend(system.kernel.boot_options) if system.kernel.boot_options is defined %}
33 +{%- if kernel_boot_opts %}
37 -{%- if system.kernel.isolcpu is defined %}
39 -/etc/default/grub.d/90-isolcpu.cfg:
41 - - contents: 'GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT isolcpus={{ system.kernel.isolcpu }}"'
43 - - file: grub_d_directory
44 -{%- if grains.get('virtual_subtype', None) not in ['Docker', 'LXC'] %}
51 -{%- if system.kernel.elevator is defined %}
53 -/etc/default/grub.d/91-elevator.cfg:
54 +/etc/default/grub.d/99-custom-settings.cfg:
56 - - contents: 'GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT elevator={{ system.kernel.elevator }}"'
57 + - contents: 'GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT {{ kernel_boot_opts|join(' ') }}"'
59 - file: grub_d_directory
60 {%- if grains.get('virtual_subtype', None) not in ['Docker', 'LXC'] %}
69 {%- if system.kernel.version is defined %}