feature TSG-6676: ATCA 内部 CPU/MEM 资源管理

This commit is contained in:
luwenpeng
2021-06-22 11:05:52 +08:00
committed by fumingwei
parent 6c286242a8
commit f09988a104
27 changed files with 238 additions and 20 deletions

View File

@@ -27,10 +27,24 @@
with_items:
- /usr/lib/systemd/system/certstore.service.d
- name: "copy memory limit file to certstore.service.d"
- name: "copy slice file to certstore.service.d"
copy:
src: "{{ role_path }}/templates/service_override_memsw_limit.conf.j2"
dest: /usr/lib/systemd/system/certstore.service.d/service_override_memsw_limit.conf
src: "{{ role_path }}/templates/service_override_slice.conf.j2"
dest: /usr/lib/systemd/system/certstore.service.d/service_override_slice.conf
mode: 0644
- name: "Create /usr/lib/systemd/system/cert-redis.service.d directory if it does not exist"
file:
path: "{{ item }}"
state: directory
mode: '0755'
with_items:
- /usr/lib/systemd/system/cert-redis.service.d
- name: "copy slice file to cert-redis.service.d"
copy:
src: "{{ role_path }}/templates/service_override_slice.conf.j2"
dest: /usr/lib/systemd/system/cert-redis.service.d/service_override_slice.conf
mode: 0644
- name: "copy cert-redis file to dest"

View File

@@ -1,3 +0,0 @@
[Service]
MemoryLimit=16G
ExecStartPost=/bin/bash -c "echo 16G > /sys/fs/cgroup/memory/system.slice/certstore.service/memory.memsw.limit_in_bytes"

View File

@@ -0,0 +1,2 @@
[Service]
Slice=workload.slice

View File

@@ -45,6 +45,48 @@
dest: /usr/lib/systemd/system/exporter-ipmi.service
tags: template
- name: "Create /usr/lib/systemd/system/exporter-node.service.d directory if it does not exist"
file:
path: "{{ item }}"
state: directory
mode: '0755'
with_items:
- /usr/lib/systemd/system/exporter-node.service.d
- name: "Create /usr/lib/systemd/system/exporter-systemd.service.d directory if it does not exist"
file:
path: "{{ item }}"
state: directory
mode: '0755'
with_items:
- /usr/lib/systemd/system/exporter-systemd.service.d
- name: "Create /usr/lib/systemd/system/exporter-ipmi.service.d directory if it does not exist"
file:
path: "{{ item }}"
state: directory
mode: '0755'
with_items:
- /usr/lib/systemd/system/exporter-ipmi.service.d
- name: "copy slice file to exporter-node.service.d"
copy:
src: "{{ role_path }}/templates/service_override_slice.conf.j2"
dest: /usr/lib/systemd/system/exporter-node.service.d/service_override_slice.conf
mode: 0644
- name: "copy slice file to exporter-systemd.service.d"
copy:
src: "{{ role_path }}/templates/service_override_slice.conf.j2"
dest: /usr/lib/systemd/system/exporter-systemd.service.d/service_override_slice.conf
mode: 0644
- name: "copy slice file to exporter-ipmi.service.d"
copy:
src: "{{ role_path }}/templates/service_override_slice.conf.j2"
dest: /usr/lib/systemd/system/exporter-ipmi.service.d/service_override_slice.conf
mode: 0644
##################### exporter #####################
- name: 'exporter-node service start'
systemd:

View File

@@ -0,0 +1,2 @@
[Service]
Slice=workload.slice

View File

@@ -10,6 +10,34 @@
dest: "/usr/lib/systemd/system"
mode: 0644
- name: "Create /usr/lib/systemd/system/maat-redis.service.d directory if it does not exist"
file:
path: "{{ item }}"
state: directory
mode: '0755'
with_items:
- /usr/lib/systemd/system/maat-redis.service.d
- name: "Create /usr/lib/systemd/system/maat-redis-exporter.service.d directory if it does not exist"
file:
path: "{{ item }}"
state: directory
mode: '0755'
with_items:
- /usr/lib/systemd/system/maat-redis-exporter.service.d
- name: "copy slice file to maat-redis.service.d"
copy:
src: "{{ role_path }}/templates/service_override_slice.conf.j2"
dest: /usr/lib/systemd/system/maat-redis.service.d/service_override_slice.conf
mode: 0644
- name: "copy slice file to maat-redis-exporter.service.d"
copy:
src: "{{ role_path }}/templates/service_override_slice.conf.j2"
dest: /usr/lib/systemd/system/maat-redis-exporter.service.d/service_override_slice.conf
mode: 0644
- name: "Template the maat-redis.conf"
template:
src: "{{ role_path }}/templates/maat-redis.conf.j2.j2"

View File

@@ -0,0 +1,2 @@
[Service]
Slice=workload.slice

View File

@@ -10,6 +10,20 @@
src: "{{ role_path }}/templates/mrzcpd.j2"
dest: /etc/sysconfig/mrzcpd
- name: "Create /usr/lib/systemd/system/mrzcpd.service.d directory if it does not exist"
file:
path: "{{ item }}"
state: directory
mode: '0755'
with_items:
- /usr/lib/systemd/system/mrzcpd.service.d
- name: "copy slice file to mrzcpd.service.d"
copy:
src: "{{ role_path }}/templates/service_override_slice.conf.j2"
dest: /usr/lib/systemd/system/mrzcpd.service.d/service_override_slice.conf
mode: 0644
- name: "update mrglobal.conf - TSG9140"
template:
src: "{{ role_path }}/templates/mrglobal.conf.j2.j2.9000NPBP01R01"

View File

@@ -0,0 +1,2 @@
[Service]
Slice=workload.slice

View File

@@ -3,7 +3,6 @@
src: '{{ role_path }}/files/'
dest: /tmp/ansible_deploy/
- name: "redis rpm install:install redis"
yum:
name:
@@ -11,6 +10,20 @@
- "/tmp/ansible_deploy/redis40u-4.0.14-1.ius.centos7.x86_64.rpm"
state: present
- name: "Create /usr/lib/systemd/system/redis.service.d directory if it does not exist"
file:
path: "{{ item }}"
state: directory
mode: '0755'
with_items:
- /usr/lib/systemd/system/redis.service.d
- name: "copy slice file to redis.service.d"
copy:
src: "{{ role_path }}/templates/service_override_slice.conf.j2"
dest: /usr/lib/systemd/system/redis.service.d/service_override_slice.conf
mode: 0644
- name: "redis exporter"
copy:
src: '{{ role_path }}/files/'

View File

@@ -0,0 +1,2 @@
[Service]
Slice=workload.slice

View File

@@ -137,10 +137,10 @@
dest: /usr/lib/systemd/system/sapp.service.d/service_override_timeoutsec.conf
mode: 0644
- name: "copy memory limit file to sapp.service.d"
- name: "copy slice file to sapp.service.d"
copy:
src: "{{ role_path }}/templates/service_override_memsw_limit.conf.j2"
dest: /usr/lib/systemd/system/sapp.service.d/service_override_memsw_limit.conf
src: "{{ role_path }}/templates/service_override_slice.conf.j2"
dest: /usr/lib/systemd/system/sapp.service.d/service_override_slice.conf
mode: 0644
- name: "copy env conf to sapp.service.d"

View File

@@ -1,3 +0,0 @@
[Service]
MemoryLimit=80G
ExecStartPost=/bin/bash -c "echo 80G > /sys/fs/cgroup/memory/system.slice/sapp.service/memory.memsw.limit_in_bytes"

View File

@@ -0,0 +1,2 @@
[Service]
Slice=workload.slice

View File

@@ -123,3 +123,70 @@
dest: /usr/bin/set-enp1s2-macaddr.sh
mode: 0777
tags: template
# systemctl set-property user.slice CPUShares=1500 MemoryLimit=8G
# systemctl set-property system.slice CPUShares=1000 MemoryLimit=8G
# systemctl set-property workload.slice CPUShares=7500 MemoryLimit=110G
# workload.slice
- name: "Create /etc/systemd/system/workload.slice.d/ directory if it does not exist"
file:
path: "{{ item }}"
state: directory
mode: '0755'
with_items:
- /etc/systemd/system/workload.slice.d/
- name: "copy 50-CPUShares.conf to workload.slice.d"
copy:
src: "{{ role_path }}/templates/override_workload_slice_cpu.conf.j2"
dest: /etc/systemd/system/workload.slice.d/50-CPUShares.conf
mode: 0644
- name: "copy 50-MemoryLimit.conf to workload.slice.d"
copy:
src: "{{ role_path }}/templates/override_workload_slice_mem.conf.j2"
dest: /etc/systemd/system/workload.slice.d/50-MemoryLimit.conf
mode: 0644
# user.slice
- name: "Create /etc/systemd/system/user.slice.d/ directory if it does not exist"
file:
path: "{{ item }}"
state: directory
mode: '0755'
with_items:
- /etc/systemd/system/user.slice.d/
- name: "copy 50-CPUShares.conf to user.slice.d"
copy:
src: "{{ role_path }}/templates/override_user_slice_cpu.conf.j2"
dest: /etc/systemd/system/user.slice.d/50-CPUShares.conf
mode: 0644
- name: "copy 50-MemoryLimit.conf to user.slice.d"
copy:
src: "{{ role_path }}/templates/override_user_slice_mem.conf.j2"
dest: /etc/systemd/system/user.slice.d/50-MemoryLimit.conf
mode: 0644
# system.slice
- name: "Create /etc/systemd/system/system.slice.d/ directory if it does not exist"
file:
path: "{{ item }}"
state: directory
mode: '0755'
with_items:
- /etc/systemd/system/system.slice.d/
- name: "copy 50-CPUShares.conf to system.slice.d"
copy:
src: "{{ role_path }}/templates/override_system_slice_cpu.conf.j2"
dest: /etc/systemd/system/system.slice.d/50-CPUShares.conf
mode: 0644
- name: "copy 50-MemoryLimit.conf to system.slice.d"
copy:
src: "{{ role_path }}/templates/override_system_slice_mem.conf.j2"
dest: /etc/systemd/system/system.slice.d/50-MemoryLimit.conf
mode: 0644

View File

@@ -0,0 +1,2 @@
[Slice]
CPUShares=1000

View File

@@ -0,0 +1,2 @@
[Slice]
MemoryLimit=8G

View File

@@ -0,0 +1,2 @@
[Slice]
CPUShares=1500

View File

@@ -0,0 +1,2 @@
[Slice]
MemoryLimit=8G

View File

@@ -0,0 +1,2 @@
[Slice]
CPUShares=7500

View File

@@ -0,0 +1,2 @@
[Slice]
MemoryLimit=110G

View File

@@ -21,6 +21,20 @@
dest: /usr/lib/systemd/system
mode: 0644
- name: "Create /usr/lib/systemd/system/telegraf_statistic.service.d/ directory if it does not exist"
file:
path: "{{ item }}"
state: directory
mode: '0755'
with_items:
- /usr/lib/systemd/system/telegraf_statistic.service.d
- name: "copy slice file to telegraf_statistic.service.d"
copy:
src: "{{ role_path }}/templates/service_override_slice.conf.j2"
dest: /usr/lib/systemd/system/telegraf_statistic.service.d/service_override_slice.conf
mode: 0644
##################### telegraf #####################
- name: "disable telegraf"

View File

@@ -0,0 +1,2 @@
[Service]
Slice=workload.slice

View File

@@ -68,10 +68,10 @@
src: "{{ role_path }}/templates/require-mrzcpd.conf.j2"
dest: /usr/lib/systemd/system/tfe.service.d/require-mrzcpd.conf
- name: "copy memory limit file to tfe.service.d"
- name: "copy slice file to tfe.service.d"
copy:
src: "{{ role_path }}/templates/service_override_memsw_limit.conf.j2"
dest: /usr/lib/systemd/system/tfe.service.d/service_override_memsw_limit.conf
src: "{{ role_path }}/templates/service_override_slice.conf.j2"
dest: /usr/lib/systemd/system/tfe.service.d/service_override_slice.conf
mode: 0644
##################### tfe #####################

View File

@@ -1,3 +0,0 @@
[Service]
MemoryLimit=100G
ExecStartPost=/bin/bash -c "echo 100G > /sys/fs/cgroup/memory/system.slice/tfe.service/memory.memsw.limit_in_bytes"

View File

@@ -0,0 +1,2 @@
[Service]
Slice=workload.slice

View File

@@ -39,9 +39,16 @@
dest: /usr/lib/systemd/system/tsg-diagnose.service
mode: 0644
- name: "Create /usr/lib/systemd/system/tsg-diagnose.service.d/ directory if it does not exist"
file:
path: "{{ item }}"
state: directory
mode: '0755'
with_items:
- /usr/lib/systemd/system/tsg-diagnose.service.d
- name: "copy prestart file to tsg-diagnose.service.d"
copy:
src: "{{ role_path }}/files/service_override_prestart.conf"
dest: /usr/lib/systemd/system/tsg-diagnose.service.d/
mode: 0644
mode: 0644