2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-08-27 09:06:39 +00:00

fix(enablekdump): stage the NFS dump setup under a per-node directory

For the RHEL 7/8 NFS path, enablekdump created var/crash and a dummy proc
file at the root of the shared dump export, from every node, at deploy.
It also mounted the export over a general-purpose directory such as /mnt.

kdump checks that the dump path exists on the target when it builds the
initrd, so the path has to exist at deploy time. Create only this node's
own subdirectory, $NODE/var/crash, and point kdump.conf at
path /$NODE/var/crash. Each node now writes only under its own subdir, so
nodes no longer share or collide at the export root, and the dump lands in
the node's directory. The setup mounts a dedicated /mnt/kdumpsetup rather
than a general-purpose directory.

The dummy proc file only ever mattered to the RHEL 7 dracut check, which
wants root= to look like a real filesystem. Keep it for RHEL 7, per node,
and point root= at $KDIP:$KDPATH/$NODE. RHEL 8 no longer writes it.

This design was identified by a lenovobuild change and validated on a
running node: a real kernel panic saved the vmcore under the node's own
directory, and nothing was written to the export root.
This commit is contained in:
Vinícius Ferrão
2026-08-17 14:34:37 -03:00
parent 875a6ef40d
commit 38cad9c5bb
+16 -17
View File
@@ -92,16 +92,13 @@ if [ ! -z "$DUMP" ]; then
KDIP=${XCAT%:*}
fi
# workaround for RHEL6
# xCAT sets NODE in the postscript environment; fall back to the short
# hostname so a per-node dump path is still used if run by hand.
[ -z "$NODE" ] && NODE=$(hostname -s)
# the $KDIP:$KDPATH directory will be used to generate the initrd for kdump service
MOUNTPATH=""
if (pmatch $OSVER "*6\.*"); then
MOUNTPATH="/tmp"
elif (pmatch $OSVER "*[78]\.*"); then
MOUNTPATH="/mnt"
else
MOUNTPATH="/var/tmp"
fi
MOUNTPATH="/mnt/kdumpsetup"
mkdir -p $MOUNTPATH
if [ "$KDPROTO" = "nfs" ]; then
if (pmatch $OSVER "sle*") || (pmatch $OSVER "suse*") || [ -f /etc/SuSE-release ] || [ -f /etc/SUSE-brand ]; then
@@ -238,16 +235,14 @@ EOF
else
/bin/echo "nfs server is not available"
fi
[ -d $MOUNTPATH/var/crash ] || mkdir -p $MOUNTPATH/var/crash
#The initramfs used in kdump does not need "root", however, the initramfs refused to continue
#if no valid "root" provided in redhat7.1 kdump; As a workaround,we provide a fake "root=nfs:$KDIP:$KDPATH"
#with a dummy "proc" inside, which will fake "root=nfs:$KDIP:$KDPATH" as a valid root directory
[ -e $MOUNTPATH/proc ] || echo "Dummy file: fake the /proc to pass the checking of 'root=' inside dracut-cmdline " > $MOUNTPATH/proc
# Create only this node's own subdirectory on the dump target.
# kdump checks the dump path exists when it builds the initrd, so
# it must exist now, at deploy time.
mkdir -p $MOUNTPATH/$NODE/var/crash
echo "nfs $KDIP:$KDPATH" > /etc/kdump.conf
echo "default shell" >> /etc/kdump.conf
echo "path /var/crash" >> /etc/kdump.conf
echo "path /$NODE/var/crash" >> /etc/kdump.conf
echo "core_collector makedumpfile -c --message-level 1 -d 31" >> /etc/kdump.conf
#strip "xcat" out of the initramfs for kdump
echo "dracut_args --omit \"xcat\"" >> /etc/kdump.conf
@@ -264,7 +259,11 @@ EOF
done
sed -i "s#^[\t ]*KDUMP_COMMANDLINE=\"#KDUMP_COMMANDLINE=\"$kdumpcmdline#" /etc/sysconfig/kdump
if (pmatch $OSVER "rhel7*") || (pmatch $OSVER "rhels7*"); then
sed -i "s#^[\t ]*KDUMP_COMMANDLINE_APPEND=\"#KDUMP_COMMANDLINE_APPEND=\"root=nfs:$KDIP:$KDPATH #" /etc/sysconfig/kdump
# The RHEL7 kdump initramfs refuses to continue unless root=
# names a valid filesystem, checked by dracut-cmdline at crash
# time, so give this node's subdir a dummy /proc for it.
[ -e $MOUNTPATH/$NODE/proc ] || echo "xCAT: dummy /proc so RHEL7 dracut-cmdline accepts root=" > $MOUNTPATH/$NODE/proc
sed -i "s#^[\t ]*KDUMP_COMMANDLINE_APPEND=\"#KDUMP_COMMANDLINE_APPEND=\"root=nfs:$KDIP:$KDPATH/$NODE #" /etc/sysconfig/kdump
fi
[ -f /etc/dracut.conf ] && mv /etc/dracut.conf /tmp/dracut.conf
restartservice kdump