import kexec-tools-2.0.25-5.el8

This commit is contained in:
CentOS Sources 2023-05-16 06:22:12 +00:00 committed by root
parent 7f841f0070
commit b0cb23d8bd
9 changed files with 174 additions and 18 deletions

2
.gitignore vendored
View File

@ -1,3 +1,3 @@
SOURCES/1.7.1.tar.gz
SOURCES/eppic_050615.tar.gz
SOURCES/kexec-tools-2.0.24.tar.xz
SOURCES/kexec-tools-2.0.25.tar.xz

View File

@ -1,3 +1,3 @@
8f8485c2a1edbc730f4fa1b96ae3ec8d8f1f9761 SOURCES/1.7.1.tar.gz
a096c8e0892b559f40b01916aae240652f75b68a SOURCES/eppic_050615.tar.gz
62b7a99779d66ffd07a1684f7b640d32c9697f0c SOURCES/kexec-tools-2.0.24.tar.xz
78d5d4f7e9d358ca234db9c84a551d9d411eb0b5 SOURCES/kexec-tools-2.0.25.tar.xz

View File

@ -1,5 +1,20 @@
#!/bin/bash
_save_kdump_netifs() {
local _name
if [[ -n $2 ]]; then
_name=$2
else
_name=$1
fi
unique_netifs[$1]=$_name
}
_get_kdump_netifs() {
echo -n "${!unique_netifs[@]}"
}
kdump_module_init() {
if ! [[ -d "${initdir}/tmp" ]]; then
mkdir -p "${initdir}/tmp"
@ -42,6 +57,14 @@ depends() {
_dep="$_dep ssh-client"
fi
if is_lvm2_thinp_dump_target; then
if grep -q lvmthinpool-monitor <<< $(dracut --list-modules); then
add_opt_module lvmthinpool-monitor
else
dwarning "Required lvmthinpool-monitor modules is missing! Please upgrade dracut >= 057."
fi
fi
if [ "$(uname -m)" = "s390x" ]; then
_dep="$_dep znet"
fi
@ -300,11 +323,35 @@ kdump_setup_ifname() {
echo "$_ifname"
}
kdump_install_nm_netif_allowlist() {
local _netif _except_netif _netif_allowlist _netif_allowlist_nm_conf
for _netif in $1; do
_per_mac=$(kdump_get_perm_addr "$_netif")
if [[ "$_per_mac" != 'not set' ]]; then
_except_netif="mac:$_per_mac"
else
_except_netif="interface-name:${unique_netifs[${_netif}]}"
fi
_netif_allowlist="${_netif_allowlist}except:${_except_netif};"
done
_netif_allowlist_nm_conf=${initdir}/tmp/netif_allowlist_nm_conf
cat << EOF > "$_netif_allowlist_nm_conf"
[device-others]
match-device=${_netif_allowlist}
managed=false
EOF
inst "$_netif_allowlist_nm_conf" "/etc/NetworkManager/conf.d/10-kdump-netif_allowlist.conf"
rm -f "$_netif_allowlist_nm_conf"
}
kdump_setup_bridge() {
local _netdev=$1
local _brif _dev _mac _kdumpdev
for _dev in `ls /sys/class/net/$_netdev/brif/`; do
_kdumpdev=$_dev
_kdumpdev=""
if kdump_is_bond "$_dev"; then
kdump_setup_bond "$_dev"
elif kdump_is_team "$_dev"; then
@ -316,6 +363,8 @@ kdump_setup_bridge() {
_kdumpdev=$(kdump_setup_ifname $_dev)
echo -n " ifname=$_kdumpdev:$_mac" >> ${initdir}/etc/cmdline.d/41bridge.conf
fi
_save_kdump_netifs "$_dev" "$_kdumpdev"
[[ -z $_kdumpdev ]] && _kdumpdev=$_dev
_brif+="$_kdumpdev,"
done
echo " bridge=$_netdev:$(echo $_brif | sed -e 's/,$//')" >> ${initdir}/etc/cmdline.d/41bridge.conf
@ -327,6 +376,7 @@ kdump_setup_bond() {
for _dev in `cat /sys/class/net/$_netdev/bonding/slaves`; do
_mac=$(kdump_get_perm_addr $_dev)
_kdumpdev=$(kdump_setup_ifname $_dev)
_save_kdump_netifs "$_dev" "$_kdumpdev"
echo -n " ifname=$_kdumpdev:$_mac" >> ${initdir}/etc/cmdline.d/42bond.conf
_slaves+="$_kdumpdev,"
done
@ -345,6 +395,7 @@ kdump_setup_team() {
for _dev in `teamnl $_netdev ports | awk -F':' '{print $2}'`; do
_mac=$(kdump_get_perm_addr $_dev)
_kdumpdev=$(kdump_setup_ifname $_dev)
_save_kdump_netifs "$_dev" "$_kdumpdev"
echo -n " ifname=$_kdumpdev:$_mac" >> ${initdir}/etc/cmdline.d/44team.conf
_slaves+="$_kdumpdev,"
done
@ -379,6 +430,7 @@ kdump_setup_vlan() {
_kdumpdev="$(kdump_setup_ifname $_phydev)"
echo " vlan=$(kdump_setup_ifname $_netdev):$_kdumpdev ifname=$_kdumpdev:$_netmac" > ${initdir}/etc/cmdline.d/43vlan.conf
fi
_save_kdump_netifs "$_phydev" "$_kdumpdev"
}
# find online znet device
@ -420,10 +472,13 @@ kdump_setup_znet() {
source_ifcfg_file $_netdev
[[ -z "$NETTYPE" ]] && return
[[ -z "$SUBCHANNELS" ]] && return
for i in $OPTIONS; do
_options=${_options},$i
done
echo rd.znet=${NETTYPE},${SUBCHANNELS}${_options} rd.znet_ifname=$_netdev:${SUBCHANNELS} > ${initdir}/etc/cmdline.d/30znet.conf
echo rd.znet=${NETTYPE},${SUBCHANNELS}${_options} rd.znet_ifname=$(kdump_setup_ifname $_netdev):${SUBCHANNELS} > ${initdir}/etc/cmdline.d/30znet.conf
}
# Setup dracut to bringup a given network interface
@ -477,6 +532,7 @@ kdump_setup_netdev() {
_ifname_opts=" ifname=$kdumpnic:$_netmac"
echo "$_ifname_opts" >> $_ip_conf
fi
_save_kdump_netifs "$_netdev" "$_kdumpdev"
kdump_setup_dns "$_netdev"
@ -765,7 +821,7 @@ kdump_check_iscsi_targets () {
# If our prerequisites are not met, fail anyways.
type -P iscsistart >/dev/null || return 1
kdump_check_setup_iscsi() (
kdump_check_setup_iscsi() {
local _dev
_dev=$1
@ -775,7 +831,7 @@ kdump_check_iscsi_targets () {
cd ..
done
[[ -d iscsi_session ]] && kdump_setup_iscsi_device "$PWD"
)
}
[[ $hostonly ]] || [[ $mount_needs ]] && {
for_each_host_dev_and_slaves_all kdump_check_setup_iscsi
@ -941,7 +997,8 @@ kdump_install_systemd_conf() {
}
install() {
local arch
declare -A unique_netifs
local arch _netifs
kdump_module_init
kdump_install_conf
@ -993,6 +1050,11 @@ install() {
# at some point of time.
kdump_check_iscsi_targets
_netifs=$(_get_kdump_netifs)
if [[ -n "$_netifs" ]]; then
kdump_install_nm_netif_allowlist "$_netifs"
fi
kdump_install_systemd_conf
# For the lvm type target under kdump, in /etc/lvm/lvm.conf we can

38
SOURCES/kdump.conf → SOURCES/gen-kdump-conf.sh Normal file → Executable file
View File

@ -1,3 +1,12 @@
#!/bin/bash
# $1: target arch
SED_EXP=""
generate()
{
sed "$SED_EXP" << EOF
# This file contains a series of commands to perform (in order) in the kdump
# kernel after a kernel crash in the crash kernel(1st kernel) has happened.
#
@ -183,3 +192,32 @@ core_collector makedumpfile -l --message-level 7 -d 31
#dracut_args --omit-drivers "cfg80211 snd" --add-drivers "ext2 ext3"
#fence_kdump_args -p 7410 -f auto -c 0 -i 10
#fence_kdump_nodes node1 node2
EOF
}
update_param()
{
SED_EXP="${SED_EXP}s/^$1.*$/$1 $2/;"
}
case "$1" in
aarch64)
;;
i386)
;;
ppc64)
;;
ppc64le)
;;
s390x)
update_param core_collector \
"makedumpfile -c --message-level 7 -d 31"
;;
x86_64)
;;
*)
echo "Warning: Unknown architecture '$1', using default kdump.conf template."
;;
esac
generate

View File

@ -145,9 +145,15 @@ dump_fs()
$CORE_COLLECTOR /proc/vmcore $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore-incomplete
_exitcode=$?
if [ $_exitcode -eq 0 ]; then
mv $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore-incomplete $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore
sync
dinfo "saving vmcore complete"
sync -f "$_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore-incomplete"
_sync_exitcode=$?
if [ $_sync_exitcode -eq 0 ]; then
mv "$_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore-incomplete" "$_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore"
dinfo "saving vmcore complete"
else
derror "sync vmcore failed, _exitcode:$_sync_exitcode"
return 1
fi
else
derror "saving vmcore failed, _exitcode:$_exitcode"
fi

View File

@ -7,6 +7,7 @@ DEFAULT_PATH="/var/crash/"
FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump"
FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send"
FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled"
LVM_CONF="/etc/lvm/lvm.conf"
is_fadump_capable()
{
@ -62,6 +63,15 @@ is_fs_dump_target()
egrep -q "^ext[234]|^xfs|^btrfs|^minix" /etc/kdump.conf
}
is_lvm2_thinp_device()
{
_device_path=$1
_lvm2_thin_device=$(lvm lvs -S 'lv_layout=sparse && lv_layout=thin' \
--nosuffix --noheadings -o vg_name,lv_name "$_device_path" 2> /dev/null)
[ -n "$_lvm2_thin_device" ]
}
strip_comments()
{
echo $@ | sed -e 's/\(.*\)#.*/\1/'
@ -161,6 +171,12 @@ is_dump_to_rootfs()
grep -E "^(failure_action|default)[[:space:]]dump_to_rootfs" /etc/kdump.conf >/dev/null
}
is_lvm2_thinp_dump_target()
{
_target=$(get_block_dump_target)
[ -n "$_target" ] && is_lvm2_thinp_device "$_target"
}
get_failure_action_target()
{
local _target
@ -734,7 +750,13 @@ prepare_kdump_bootinfo()
if [[ -z $KDUMP_KERNELVER ]]; then
KDUMP_KERNELVER=$(uname -r)
nondebug_kernelver=$(sed -n -e 's/\(.*\)+debug$/\1/p' <<< "$KDUMP_KERNELVER")
# Fadump uses the regular bootloader, unlike kdump. So, use the same version
# for default kernel and capture kernel unless specified explicitly with
# KDUMP_KERNELVER option.
if ! is_fadump_capable; then
nondebug_kernelver=$(sed -n -e 's/\(.*\)+debug$/\1/p' <<< "$KDUMP_KERNELVER")
fi
fi
# Use nondebug kernel if possible, because debug kernel will consume more memory and may oom.

View File

@ -398,6 +398,7 @@ check_files_modified()
# HOOKS is mandatory and need to check the modification time
files="$files $HOOKS"
is_lvm2_thinp_dump_target && files="$files $LVM_CONF"
check_exist "$files" && check_executable "$EXTRA_BINS"
[ $? -ne 0 ] && return 2
@ -486,8 +487,9 @@ check_fs_modified()
fi
# No need to check in case of raw target.
# Currently we do not check also if ssh/nfs target is specified
if is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target; then
# Currently we do not check also if ssh/nfs/thinp target is specified
if is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target ||
is_lvm2_thinp_dump_target; then
return 0
fi
@ -694,6 +696,7 @@ load_kdump()
# and release it.
exec 12>&2
exec 2>> $KDUMP_LOG_PATH/kdump.log
chmod 600 $KDUMP_LOG_PATH/kdump.log
PS4='+ $(date "+%Y-%m-%d %H:%M:%S") ${BASH_SOURCE}@${LINENO}: '
set -x

View File

@ -226,7 +226,7 @@ check_user_configured_target()
# For user configured target, use $SAVE_PATH as the dump path within the target
if [ ! -d "$_mnt/$SAVE_PATH" ]; then
perror_exit "Dump path \"$_mnt/$SAVE_PATH\" does not exist in dump target \"$_target\""
perror_exit "Dump path \"$SAVE_PATH\" does not exist in dump target \"$_target\""
fi
check_size fs "$_target"

View File

@ -1,6 +1,6 @@
Name: kexec-tools
Version: 2.0.24
Release: 6%{?dist}
Version: 2.0.25
Release: 5%{?dist}
License: GPLv2
Group: Applications/System
Summary: The kexec/kdump userspace component
@ -12,7 +12,7 @@ Source3: kdump.sysconfig.x86_64
Source4: kdump.sysconfig.i386
Source5: kdump.sysconfig.ppc64
Source7: mkdumprd
Source8: kdump.conf
Source8: gen-kdump-conf.sh
Source9: https://github.com/makedumpfile/makedumpfile/archive/1.7.1.tar.gz
Source10: kexec-kdump-howto.txt
Source12: mkdumprd.8
@ -158,6 +158,9 @@ cp %{SOURCE27} .
cp %{SOURCE28} .
cp %{SOURCE31} .
# Generate sysconfig file
%{SOURCE8} %{_target_cpu} > kdump.conf
make
%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
make -C eppic/libeppic
@ -196,7 +199,7 @@ install -m 644 $SYSCONFIG $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/kdump
install -m 755 %{SOURCE7} $RPM_BUILD_ROOT/usr/sbin/mkdumprd
install -m 755 %{SOURCE36} $RPM_BUILD_ROOT/usr/sbin/mkfadumprd
install -m 644 %{SOURCE8} $RPM_BUILD_ROOT%{_sysconfdir}/kdump.conf
install -m 644 kdump.conf $RPM_BUILD_ROOT%{_sysconfdir}/kdump.conf
install -m 644 kexec/kexec.8 $RPM_BUILD_ROOT%{_mandir}/man8/kexec.8
install -m 644 %{SOURCE12} $RPM_BUILD_ROOT%{_mandir}/man8/mkdumprd.8
install -m 644 %{SOURCE25} $RPM_BUILD_ROOT%{_mandir}/man8/kdumpctl.8
@ -393,6 +396,28 @@ done
%endif
%changelog
* Wed Jan 18 2023 Pingfan Liu <piliu@redhat.com> - 2.0.25-5
dracut-module-setup: Fix invalid rd.znet command line entry
dracut-module-setup: Fix persistent nic name on s390
* Mon Jan 9 2023 Pingfan Liu <piliu@redhat.com> - 2.0.25-4
- Don't check fs modified when dump target is lvm2 thinp
- Add dependency of dracut lvmthinpool-monitor module
- lvm.conf should be check modified if lvm2 thinp enabled
- Add lvm2 thin provision dump target checker
- Fix the sync issue for dump_fs
* Fri Dec 2 2022 Pingfan Liu <piliu@redhat.com> - 2.0.25-3
- kdump.conf: use a simple generator script to maintain
- Reduce kdump memory consumption by not letting NetworkManager manage unneeded network interfaces
* Mon Oct 17 2022 Pingfan Liu <piliu@redhat.com> - 2.0.25-2
- mkdumprd: Improve error messages on non-existing NFS target directories
- fadump: avoid non-debug kernel use for fadump case
* Sun Sep 18 2022 Pingfan Liu <piliu@redhat.com> - 2.0.24-7
- kdumpctl: make the kdump.log root-readable-only
* Mon Jul 18 2022 Pingfan Liu <piliu@redhat.com> - 2.0.24-6
- kdump-lib: Add the CoreOS kernel dir to the boot_dirlist
- kdump-lib: attempt to fix BOOT_IMAGE detection