瀏覽代碼

Disable/enable for swap entities

* Add ability to disable some swap entities and enable others

Change-Id: Ic2f947f7b9fc6f29411a9171d68eb0836fce29ed
Related-task: #PROD-23150 (PROD:23150)
pull/170/head
Ivan Berezovskiy 6 年之前
父節點
當前提交
17cb8b5d01
共有 1 個檔案被更改,包括 18 行新增0 行删除
  1. +18
    -0
      linux/storage/swap.sls

+ 18
- 0
linux/storage/swap.sls 查看文件

@@ -53,6 +53,24 @@ linux_set_swap_file_status_{{ swap.device }}:

{%- endif %}

{%- else %}

{{ swap.device }}:
module.run:
- name: mount.rm_fstab
- m_name: none
- device: {{ swap.device }}
- onlyif: grep -q {{ swap.device }} /etc/fstab

linux_disable_swap_{{ swap.engine }}_{{ swap.device }}:
cmd.run:
{%- if swap.engine == 'partition' %}
- name: 'swapoff {{ swap.device }}'
{%- elif swap.engine == 'file' %}
- name: 'swapoff {{ swap.device }} && rm -f {{ swap.device }}'
{%- endif %}
- onlyif: file -L -s {{ swap.device }} | grep -q 'swap file'

{%- endif %}

{%- endfor %}

Loading…
取消
儲存