Skip to content

Commit

Permalink
fix: nfs client check, updated RFS
Browse files Browse the repository at this point in the history
Signed-off-by: stafaniasaju <[email protected]>
  • Loading branch information
stafaniasaju committed Dec 2, 2024
1 parent ff0055d commit 8e522b9
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 12 deletions.
23 changes: 11 additions & 12 deletions roles/powervs_configure_os_for_sap/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,19 @@
state: latest

# to Ensure that NFS and rpcbind daemon are up.
- name: Ensure NFS client is running
- name: Ensure NFS client is running (RHEL)
ansible.builtin.service:
name: nfs-client.target
state: started
enabled: true
when: "ansible_distribution is match('RedHat*')"

- name: Ensure NFS client is running (SLES)
ansible.builtin.service:
name: nfs
state: started
enabled: true
when: "ansible_distribution is match('SLES*')"

- name: Ensure rpcbind is running
ansible.builtin.service:
Expand All @@ -105,17 +113,8 @@
changed_when: false

# enable RFS
- name: Update /proc/sys/net/core/rps_sock_flow_entries
ansible.legacy.shell: "echo 32768 > /proc/sys/net/core/rps_sock_flow_entries"

- name: Find all rx-* files in /sys/class/net/*/queues/
ansible.legacy.shell: "find /sys/class/net/*/queues/ -name 'rx-*' | grep -v '/lo/'"
register: rx_files

- name: Update and persist all rx-* files
ansible.legacy.shell: "echo '32768' > {{ item }}/rps_flow_cnt && sync {{ item }}/rps_flow_cnt"
loop: "{{ rx_files.stdout_lines }}"
when: rx_files.stdout_lines is defined
- name: Tune RHEL for SAP
ansible.builtin.include_tasks: "rfs.yml"

# sap tuning
- name: Tune RHEL for SAP
Expand Down
60 changes: 60 additions & 0 deletions roles/powervs_configure_os_for_sap/tasks/rfs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
# Ensure RFS configuration persists
- name: Configure RFS with 32768
hosts: all
become: yes
tasks:
- name: Update rps_sock_flow_entries runtime value
ansible.builtin.shell: sysctl -w net.core.rps_sock_flow_entries=32768
changed_when: false

- name: Persist rps_sock_flow_entries in sysctl.conf
lineinfile:
path: /etc/sysctl.conf
regexp: '^net.core.rps_sock_flow_entries'
line: 'net.core.rps_sock_flow_entries=32768'

- name: Reload sysctl configuration
ansible.builtin.shell: sysctl -p

- name: Create custom systemd unit for RFS configuration
copy:
dest: /etc/systemd/system/rfs-config.service
content: |
[Unit]
Description=Set RPS flow control settings
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
ExecStart=/bin/bash -c "sleep 5; for file in $(find /sys/class/net/*/queues/ -name 'rx-*' | grep -v '/lo/'); do echo 32768 > $file/rps_flow_cnt; done"
[Install]
WantedBy=multi-user.target
- name: Reload systemd manager configuration
ansible.builtin.shell: systemctl daemon-reload

- name: Enable and start RFS configuration service
systemd:
name: rfs-config.service
enabled: yes
state: restarted

- name: Verify sysctl value after service start
ansible.builtin.shell: sysctl net.core.rps_sock_flow_entries
register: sysctl_value

- name: Debug sysctl value
debug:
var: sysctl_value.stdout

- name: Verify RFS runtime configuration
ansible.builtin.shell: |
find /sys/class/net/*/queues/ -name 'rx-*' | grep -v '/lo/' | xargs -I{} cat {}/rps_flow_cnt
register: rfs_runtime_values

- name: Debug RFS runtime values
debug:
var: rfs_runtime_values.stdout_lines

0 comments on commit 8e522b9

Please sign in to comment.