From 71b7a2f47c783b33965e8fc469dc44bda08cf458 Mon Sep 17 00:00:00 2001 From: Hari Bathini Date: Mon, 12 Jul 2021 15:33:03 +0530 Subject: [PATCH] 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 Reviewed-by: Pingfan Liu Acked-by: Kairui Song --- kdump-migrate-action.sh | 8 ++++++++ kdump-restart.sh | 8 ++++++++ kexec-tools.spec | 16 ++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100755 kdump-migrate-action.sh create mode 100644 kdump-restart.sh diff --git a/kdump-migrate-action.sh b/kdump-migrate-action.sh new file mode 100755 index 0000000..c516639 --- /dev/null +++ b/kdump-migrate-action.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +systemctl is-active kdump +if [ $? -ne 0 ]; then + exit 0 +fi + +/usr/lib/kdump/kdump-restart.sh diff --git a/kdump-restart.sh b/kdump-restart.sh new file mode 100644 index 0000000..a9ecfc1 --- /dev/null +++ b/kdump-restart.sh @@ -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 diff --git a/kexec-tools.spec b/kexec-tools.spec index ad29bf9..7f88863 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -42,6 +42,8 @@ Source31: kdump-logger.sh Source32: mkfadumprd Source33: 92-crashkernel.install Source34: crashkernel-howto.txt +Source35: kdump-migrate-action.sh +Source36: kdump-restart.sh ####################################### # These are sources for mkdumpramfs @@ -60,6 +62,9 @@ Source109: dracut-early-kdump-module-setup.sh Source200: dracut-fadump-init-fadump.sh Source201: dracut-fadump-module-setup.sh +%ifarch ppc64 ppc64le +Requires(post): servicelog +%endif Requires(pre): coreutils sed zlib Requires: dracut >= 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 %{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 @@ -262,6 +271,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