kdump/ppc64: rebuild initramfs image after migration

upstream: fedora
resolves: bz2027568
conflict: The upstream patch was submitted before
          "Add file supported-kdump-targets.txt to kexec-tools"
          was added to rhel9. So there are SourceXX conflict
          in spec file. And similar code merge with patch
          "add keyutils as a weak dependency for POWER"

commit 71b7a2f47c
Author: Hari Bathini <hbathini@linux.ibm.com>
Date:   Mon Jul 12 15:33:03 2021 +0530

    kdump/ppc64: rebuild initramfs image after migration

    Dump capture initramfs needs rebuild after partition migration (LPM).
    Use servicelog notification mechanism to invoke kdump rebuild after
    migration.

    Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
    Reviewed-by: Pingfan Liu <piliu@redhat.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
This commit is contained in:
Tao Liu 2021-12-03 18:13:09 +08:00
parent 9e86be70ac
commit de65197ba0
3 changed files with 35 additions and 5 deletions

8
kdump-migrate-action.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
systemctl is-active kdump
if [ $? -ne 0 ]; then
exit 0
fi
/usr/lib/kdump/kdump-restart.sh

8
kdump-restart.sh Normal file
View File

@ -0,0 +1,8 @@
#!/bin/bash
export PATH="$PATH:/usr/bin:/usr/sbin"
exec >>/var/log/kdump-migration.log 2>&1
echo "kdump: Partition Migration detected. Rebuilding initramfs image to reload."
/usr/bin/kdumpctl rebuild
/usr/bin/kdumpctl reload

View File

@ -42,7 +42,9 @@ Source31: kdump-logger.sh
Source32: mkfadumprd
Source33: 92-crashkernel.install
Source34: crashkernel-howto.txt
Source35: supported-kdump-targets.txt
Source35: kdump-migrate-action.sh
Source36: kdump-restart.sh
Source37: supported-kdump-targets.txt
#######################################
# These are sources for mkdumpramfs
@ -57,15 +59,16 @@ Source107: dracut-kdump-emergency.target
Source108: dracut-early-kdump.sh
Source109: dracut-early-kdump-module-setup.sh
%ifarch ppc64 ppc64le
Recommends: keyutils
%endif
Source200: dracut-fadump-init-fadump.sh
Source201: dracut-fadump-module-setup.sh
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
%ifarch ppc64 ppc64le
Requires(post): servicelog
Recommends: keyutils
%endif
Requires(pre): coreutils sed zlib
Requires: dracut >= 050
Requires: dracut-network >= 050
@ -151,7 +154,7 @@ cp %{SOURCE21} .
cp %{SOURCE26} .
cp %{SOURCE27} .
cp %{SOURCE34} .
cp %{SOURCE35} .
cp %{SOURCE37} .
make
%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
@ -198,6 +201,10 @@ install -m 644 %{SOURCE25} $RPM_BUILD_ROOT%{_mandir}/man8/kdumpctl.8
install -m 755 %{SOURCE20} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib.sh
install -m 755 %{SOURCE23} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib-initramfs.sh
install -m 755 %{SOURCE31} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-logger.sh
%ifarch ppc64 ppc64le
install -m 755 %{SOURCE35} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-migrate-action.sh
install -m 755 %{SOURCE36} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-restart.sh
%endif
%ifnarch s390x
install -m 755 %{SOURCE28} $RPM_BUILD_ROOT%{_udevrulesdir}/../kdump-udev-throttler
%endif
@ -263,6 +270,13 @@ mv $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/* $RPM_BUILD_ROOT/%{d
%systemd_post kdump.service
touch /etc/kdump.conf
ARCH=`uname -m`
if [ "$ARCH" == "ppc64" ] || [ "$ARCH" == "ppc64le" ]
then
servicelog_notify --add --command=/usr/lib/kdump/kdump-migrate-action.sh --match='refcode="#MIGRATE" and serviceable=0' --type=EVENT --method=pairs_stdin
fi
# This portion of the script is temporary. Its only here
# to fix up broken boxes that require special settings
# in /etc/sysconfig/kdump. It will be removed when