Avoid timeout in capture-system-logs due to df command

The `df` command can stall indefinitely on stale NFS mounts,
causing the playbook to time out. This leads to the entire job
failing with POST_FAILURE status, discarding controller logs
and impacting troubleshooting.

This patch changes `capture-system-logs` to run `df` with a 60s
timeout to prevent hangs from stale NFS mounts. If 'df' times out,
the mount output may help debug which NFS share is unresponsive.

Change-Id: Ife3945802c93bd77d60b60e433ea09aade38a522
Signed-off-by: Fernando Ferraz <fernandoperches@gmail.com>
This commit is contained in:
Fernando Ferraz
2025-09-19 12:10:50 -03:00
parent 63d874e4af
commit a8fc640b67
2 changed files with 8 additions and 1 deletions

View File

@@ -446,6 +446,7 @@
/etc/sudoers.d: logs
'{{ stage_dir }}/iptables.txt': logs
'{{ stage_dir }}/df.txt': logs
'{{ stage_dir }}/mount.txt': logs
'{{ stage_dir }}/pip2-freeze.txt': logs
'{{ stage_dir }}/pip3-freeze.txt': logs
'{{ stage_dir }}/dpkg-l.txt': logs

View File

@@ -4,7 +4,13 @@
executable: /bin/bash
cmd: |
sudo iptables-save > {{ stage_dir }}/iptables.txt
df -h > {{ stage_dir }}/df.txt
# NOTE(sfernand): Run 'df' with a 60s timeout to prevent hangs from
# stale NFS mounts.
timeout -s 9 60s df -h > {{ stage_dir }}/df.txt || true
# If 'df' times out, the mount output helps debug which NFS share
# is unresponsive.
mount > {{ stage_dir }}/mount.txt
for py_ver in 2 3; do
if [[ `which python${py_ver}` ]]; then