ソースを参照

Add support for sysfs

Change-Id: I29cfe2cd9dd39b74a1d39313f78dfddc87cb79b8
pull/122/head
Filip Pytloun 7年前
コミット
361096c12a
6個のファイルの変更91行の追加10行の削除
  1. +19
    -0
      README.rst
  2. +16
    -0
      linux/files/sysfs.conf
  3. +2
    -10
      linux/system/cpu.sls
  4. +3
    -0
      linux/system/init.sls
  5. +42
    -0
      linux/system/sysfs.sls
  6. +9
    -0
      tests/pillar/system.sls

+ 19
- 0
README.rst ファイルの表示

@@ -407,6 +407,25 @@ Enable cpufreq governor for every cpu:
cpu:
governor: performance

Sysfs
~~~~~

Install sysfsutils and set sysfs attributes:

.. 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
~~~~~~~~~~~~


+ 16
- 0
linux/files/sysfs.conf ファイルの表示

@@ -0,0 +1,16 @@
# 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.iteritems() %}
{%- if key in ["mode", "owner"] %}
{%- for attr, val in value.iteritems() %}
mode {{ attr }} = {{ val }}
{%- endfor %}
{%- else %}
{{ key }} = {{ value }}
{%- endif %}
{%- endfor %}

{#-
vim: syntax=jinja
-#}

+ 2
- 10
linux/system/cpu.sls ファイルの表示

@@ -1,16 +1,8 @@
{%- from "linux/map.jinja" import system with context %}
{%- if system.cpu.governor is defined %}

linux_sysfs_package:
pkg.installed:
- pkgs:
- sysfsutils
- refresh: true

/etc/sysfs.d:
file.directory:
- require:
- pkg: linux_sysfs_package
include:
- linux.system.sysfs

ondemand_service_disable:
service.dead:

+ 3
- 0
linux/system/init.sls ファイルの表示

@@ -30,6 +30,9 @@ include:
{%- if system.cpu is defined %}
- linux.system.cpu
{%- endif %}
{%- if system.sysfs is defined %}
- linux.system.sysfs
{%- endif %}
{%- if system.locale|length > 0 %}
- linux.system.locale
{%- endif %}

+ 42
- 0
linux/system/sysfs.sls ファイルの表示

@@ -0,0 +1,42 @@
{%- from "linux/map.jinja" import system with context %}

linux_sysfs_package:
pkg.installed:
- pkgs:
- sysfsutils
- refresh: true

/etc/sysfs.d:
file.directory:
- require:
- pkg: linux_sysfs_package

{%- for name, sysfs in system.get('sysfs', {}).iteritems() %}

/etc/sysfs.d/{{ name }}.conf:
file.managed:
- source: salt://linux/files/sysfs.conf
- template: jinja
- user: root
- group: root
- mode: 0644
- defaults:
name: {{ name }}
sysfs: {{ sysfs|yaml }}
- require:
- file: /etc/sysfs.d

{%- for key, value in sysfs.iteritems() %}
{%- if key not in ["mode", "owner"] %}
{%- if grains.get('virtual_subtype', None) not in ['Docker', 'LXC'] %}
{#- Sysfs cannot be set in docker, LXC, etc. #}
linux_sysfs_write_{{ name }}_{{ key }}:
module.run:
- name: sysfs.write
- key: {{ key }}
- value: {{ value }}
{%- endif %}
{%- endif %}
{%- endfor %}

{%- endfor %}

+ 9
- 0
tests/pillar/system.sls ファイルの表示

@@ -15,6 +15,15 @@ linux:
default: "linux.ci.local$"
kernel:
isolcpu: 1,2,3,4
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
motd:
- warning: |
#!/bin/sh

読み込み中…
キャンセル
保存