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>
This commit is contained in:
Hari Bathini 2021-07-12 15:33:03 +05:30 committed by Kairui Song
parent 914a856c66
commit 71b7a2f47c
3 changed files with 32 additions and 0 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,6 +42,8 @@ Source31: kdump-logger.sh
Source32: mkfadumprd Source32: mkfadumprd
Source33: 92-crashkernel.install Source33: 92-crashkernel.install
Source34: crashkernel-howto.txt Source34: crashkernel-howto.txt
Source35: kdump-migrate-action.sh
Source36: kdump-restart.sh
####################################### #######################################
# These are sources for mkdumpramfs # These are sources for mkdumpramfs
@ -60,6 +62,9 @@ Source109: dracut-early-kdump-module-setup.sh
Source200: dracut-fadump-init-fadump.sh Source200: dracut-fadump-init-fadump.sh
Source201: dracut-fadump-module-setup.sh Source201: dracut-fadump-module-setup.sh
%ifarch ppc64 ppc64le
Requires(post): servicelog
%endif
Requires(pre): coreutils sed zlib Requires(pre): coreutils sed zlib
Requires: dracut >= 050 Requires: dracut >= 050
Requires: dracut-network >= 050 Requires: dracut-network >= 050
@ -196,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 %{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 %{SOURCE23} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib-initramfs.sh
install -m 755 %{SOURCE31} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-logger.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 %ifnarch s390x
install -m 755 %{SOURCE28} $RPM_BUILD_ROOT%{_udevrulesdir}/../kdump-udev-throttler install -m 755 %{SOURCE28} $RPM_BUILD_ROOT%{_udevrulesdir}/../kdump-udev-throttler
%endif %endif
@ -262,6 +271,13 @@ mv $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/* $RPM_BUILD_ROOT/%{d
%systemd_post kdump.service %systemd_post kdump.service
touch /etc/kdump.conf 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 # This portion of the script is temporary. Its only here
# to fix up broken boxes that require special settings # to fix up broken boxes that require special settings
# in /etc/sysconfig/kdump. It will be removed when # in /etc/sysconfig/kdump. It will be removed when