在 Red Hat Enterprise Linux 9 (RHEL 9)中引入了节能配置集 cpu-partitioning-powersave,现在在 Red Hat OpenStack Platform (RHOSP) 17.1.3 中提供。此 TuneD 配置集是在 RHOSP 17.1 NFV 环境中节省电源的基本构建块。
先决条件
访问 stack 用户的 undercloud 主机和凭据。
启用要实现节能的 CPU,以允许更高的 C-states。
如需更多信息,请参阅 tuned-profiles-cpu-partitioning (7) 的 man page 中的 max_power_state 选项。
流程
以 stack 用户的身份登录 undercloud。
Source stackrc 文件:
source ~/stackrc
$ source ~/stackrc
Copy to ClipboardCopied!Toggle word wrapToggle overflow
cat <<EOF > /home/stack/cli-overcloud-tuned-maxpower-conf.yaml
{% raw %}
---
#/home/stack/cli-overcloud-tuned-maxpower-conf.yaml
- name: Overcloud Node set tuned power state
hosts: compute-0 compute-1
any_errors_fatal: true
gather_facts: false
pre_tasks:
- name: Wait for provisioned nodes to boot
wait_for_connection:
timeout: 600
delay: 10
connection: local
tasks:
- name: Check the max power state for this system
become: true
block:
- name: Get power states
shell: "for s in /sys/devices/system/cpu/cpu2/cpuidle/*; do grep . $s/{name,latency}; done"
register: _list_of_power_states
- name: Print available power states
debug:
msg: "{{ _list_of_power_states.stdout.split('\n') }}"
- name: Check for active tuned power-save profile
stat:
path: "/etc/tuned/active_profile"
register: _active_profile
- name: Check the profile
slurp:
path: "/etc/tuned/active_profile"
when: _active_profile.stat.exists
register: _active_profile_name
- name: Print states
debug:
var: (_active_profile_name.content|b64decode|string)
- name: Check the max power state for this system
block:
- name: Check if the cstate config is present in the conf file
lineinfile:
dest: /etc/tuned/cpu-partitioning-powersave-variables.conf
regexp: '^max_power_state'
line: 'max_power_state=cstate.name:C6'
register: _cstate_entry_check
{% endraw %}
EOF
cat <<EOF > /home/stack/cli-overcloud-tuned-maxpower-conf.yaml
{% raw %}---#/home/stack/cli-overcloud-tuned-maxpower-conf.yaml-name: Overcloud Node set tuned power state
hosts: compute-0 compute-1any_errors_fatal:truegather_facts:falsepre_tasks:-name: Wait for provisioned nodes to boot
wait_for_connection:timeout:600delay:10connection: local
tasks:-name: Check the max power state for this system
become:trueblock:-name: Get power states
shell:"for s in /sys/devices/system/cpu/cpu2/cpuidle/*; do grep . $s/{name,latency}; done"register: _list_of_power_states
-name: Print available power states
debug:msg:"{{ _list_of_power_states.stdout.split('\n') }}"-name: Check for active tuned power-save profile
stat:path:"/etc/tuned/active_profile"register: _active_profile
-name: Check the profile
slurp:path:"/etc/tuned/active_profile"when: _active_profile.stat.exists
register: _active_profile_name
-name: Print states
debug:var: (_active_profile_name.content|b64decode|string)
-name: Check the max power state for this system
block:-name: Check if the cstate config is present in the conf file
lineinfile:dest: /etc/tuned/cpu-partitioning-powersave-variables.conf
regexp:'^max_power_state'line:'max_power_state=cstate.name:C6'register: _cstate_entry_check
{% endraw %}
EOF
Copy to ClipboardCopied!Toggle word wrapToggle overflow