Procházet zdrojové kódy

added possibility to use list for sysfs params

Change-Id: Id9ffc5cbbbb10fd6136d459ed461151a1800e857
related-bug: PROD-21205
pull/162/head
Ondrej Smola před 6 roky
rodič
revize
ef9bd76e4b
3 změnil soubory, kde provedl 37 přidání a 4 odebrání
  1. +18
    -2
      README.rst
  2. +10
    -1
      linux/files/sysfs.conf
  3. +9
    -1
      linux/system/sysfs.sls

+ 18
- 2
README.rst Zobrazit soubor

@@ -429,7 +429,7 @@ Load kernel modules and add them to `/etc/modules`:
- tp_smapi
- 8021q

Configure or blacklist kernel modules with additional options to `/etc/modprobe.d` following example
Configure or blacklist kernel modules with additional options to `/etc/modprobe.d` following example
will add `/etc/modprobe.d/nf_conntrack.conf` file with line `options nf_conntrack hashsize=262144`:

.. code-block:: yaml
@@ -554,7 +554,7 @@ Set additional shared library to Linux system library path
java:
- /usr/lib/jvm/jre-openjdk/lib/amd64/server
- /opt/java/jre/lib/amd64/server

Certificates
~~~~~~~~~~~~
@@ -601,6 +601,22 @@ Install sysfsutils and set sysfs attributes:
power/state: "root:power"
devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave

Optional: You can also use list that will ensure order of items.

.. code-block:: yaml

linux:
system:
sysfs:
scheduler:
block/sda/queue/scheduler: deadline
power:
- mode:
power/state: 0660
- owner:
power/state: "root:power"
- devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave

Huge Pages
~~~~~~~~~~~~


+ 10
- 1
linux/files/sysfs.conf Zobrazit soubor

@@ -1,7 +1,15 @@
# Sysfs file for {{ name }} managed by salt-minion(1)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN

{%- for key, value in sysfs.items() %}
{%- if sysfs is mapping %}
{%- set sysfs_list = [sysfs] %}
{%- else %}
{%- set sysfs_list = sysfs %}
{%- endif %}


{%- for item in sysfs_list %}
{%- for key, value in item.items() %}
{%- if key in ["mode", "owner"] %}
{%- for attr, val in value.items() %}
mode {{ attr }} = {{ val }}
@@ -10,6 +18,7 @@ mode {{ attr }} = {{ val }}
{{ key }} = {{ value }}
{%- endif %}
{%- endfor %}
{%- endfor %}

{#-
vim: syntax=jinja

+ 9
- 1
linux/system/sysfs.sls Zobrazit soubor

@@ -26,7 +26,14 @@ linux_sysfs_package:
- require:
- file: /etc/sysfs.d

{%- for key, value in sysfs.items() %}
{%- if sysfs is mapping %}
{%- set sysfs_list = [sysfs] %}
{%- else %}
{%- set sysfs_list = sysfs %}
{%- endif %}

{%- for item in sysfs_list %}
{%- for key, value in item.items() %}
{%- if key not in ["mode", "owner"] %}
{%- if grains.get('virtual_subtype', None) not in ['Docker', 'LXC'] %}
{#- Sysfs cannot be set in docker, LXC, etc. #}
@@ -40,3 +47,4 @@ linux_sysfs_write_{{ name }}_{{ key }}:
{%- endfor %}

{%- endfor %}
{%- endfor %}

Načítá se…
Zrušit
Uložit