bugfix:TSG-10492:通过修改grub.cfg文件来实现cpu isolate功能

This commit is contained in:
fumingwei
2022-05-07 15:53:41 +08:00
parent 72627badd1
commit 43b163efdc
4 changed files with 10 additions and 19 deletions

View File

@@ -66,12 +66,6 @@
dest: /usr/lib/systemd/system/system.slice.d/50-MemoryLimit.conf
mode: 0644
- name: Template the grub config
template:
src: "{{ role_path }}/templates/grub.j2.j2"
dest: /opt/tsg/tsg-os-provision/templates/grub.j2
tags: template
# 启用 IPMI
- name: "copy ipmi.conf to /etc/sysconfig/ipmi"
copy:

View File

@@ -1 +0,0 @@
GRUB_CMDLINE_LINUX="crashkernel=512M default_hugepagesz=1G hugepagesz=1G hugepages=16 intel_iommu=on iommu=pt mitigations=off psi=1 isolcpus={% raw %}{{ grub_cpu_isolate }}{% endraw %}"

View File

@@ -39,7 +39,7 @@ if [ "$(id -u)" != 0 ]; then
fi
if [ $reboot_required == 1 ]; then
/opt/tsg/tsg-os-provision/scripts/provision.sh 0
/opt/tsg/tsg-os-provision/scripts/provision.sh 2
echo "Reboot..."
reboot
else

View File

@@ -103,7 +103,7 @@
msg: "Detected that the configuration of cpu isolate has changed, please run command \"provision-config-apply --reboot\" to reboot the machine that make the configuration take effect!"
when:
- result_exec_cat_cmdline is not search(grub_cpu_isolate)
- enable_config_apply == '1'
- enable_config_apply != '2'
- name: "set keep_alive_ip"
set_fact:
@@ -114,16 +114,14 @@
cm_policy_server_ip: "{{cm.policy_server.address}}"
cm_policy_server_port: "{{ cm.policy_server.port }}"
- name: "template grub config for cpu isolate"
template:
src: ../templates/grub.j2
dest: /etc/default/grub
- name: "update grub: BIOS"
shell: grub2-mkconfig -o /boot/grub2/grub.cfg
- name: "update grub: EFI"
shell: grub2-mkconfig -o /boot/efi/EFI/rocky/grub.cfg
- name: "replace action: grub config isolate cpu"
replace:
path: "{{ item }}"
regexp: 'isolcpus=\d+-+\d+'
replace: 'isolcpus={{grub_cpu_isolate}}'
with_items:
- /boot/grub/grub.cfg
- /etc/grub.d/40_onie_grub
- name: "tsg-os-provision: Template the conflist.inf"
template: