Hi, Hari
The fix looks good, but I have a question about the kernel version
maybe we did not notice it when we review previous fadump patches.
On 09/07/16 at 06:10pm, Hari Bathini wrote:
When fadump mode is enabled, the default initrd is rebuilt with
kdump
dracut module. As the default initrd is altered, the original default
initrd is backed up. But we are not restoring it when fadump mode is
disabled. This patch tries to restore the backed up default initrd on
disabling fadump mode.
Signed-off-by: Hari Bathini <hbathini(a)linux.vnet.ibm.com>
---
kdumpctl | 42 ++++++++++++++++++++++++++++++++----------
1 file changed, 32 insertions(+), 10 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index 8d0ab81..8d883de 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -154,9 +154,6 @@ rebuild_fadump_initrd()
{
local target_initrd_tmp
- # backup fadump initrd for reference before replacing it
- backup_initrd
-
# this file tells the initrd is fadump enabled
touch /tmp/fadump.initramfs
target_initrd_tmp="$TARGET_INITRD.tmp"
@@ -190,8 +187,17 @@ rebuild_kdump_initrd()
rebuild_initrd()
{
if [ $DEFAULT_DUMP_MODE == "fadump" ]; then
+ # backup initrd for reference before replacing it
+ # with fadump aware initrd
+ backup_restore_default_initrd "backup"
+
rebuild_fadump_initrd
else
+ # check if a backup of default initrd exists. If yes,
+ # it signifies a switch from fadump mode. So, restore
+ # the backed up default initrd.
+ backup_restore_default_initrd "restore"
+
rebuild_kdump_initrd
fi
@@ -220,15 +226,31 @@ check_executable()
done
}
-backup_initrd()
+backup_restore_default_initrd()
{
- local target_initrd_bak
+ local default_initrd
+ local default_initrd_bak
+ local action=$1
+
+ default_initrd="${KDUMP_BOOTDIR}/initramfs-${kdump_kver}.img"
+ default_initrd_bak="${KDUMP_BOOTDIR}/.initramfs-${kdump_kver}.img.default"
Hari,
$kdump_kver is the kdump kernel version, it may be different with the
default kernel version. Acording to my understanding the default initrd should use
the normal boot kernel version like `uname -r`
- # Check if backup initrd is already present.
- target_initrd_bak="$TARGET_INITRD.bak"
- if [ ! -e $target_initrd_bak ];then
- echo "Backing up $TARGET_INITRD"
- cp $TARGET_INITRD $target_initrd_bak
+ if [[ $action != "restore" ]]; then
+ if [ ! -e $default_initrd_bak ]; then
+ echo "Backing up $default_initrd"
+ cp $default_initrd $default_initrd_bak
+ fi
+ else
+ # If a backup initrd exists, we must be switching back from
+ # fadump to kdump. Restore the original default initrd.
+ if [ -f $default_initrd_bak ];then
+ mv $default_initrd_bak $default_initrd
+ if [[ $? -eq 0 ]]; then
+ echo -n "Default initrd is restored as fadump mode "
+ echo "is disabled"
+ sync
+ fi
+ fi
fi
}
_______________________________________________
kexec mailing list
kexec(a)lists.fedoraproject.org
https://lists.fedoraproject.org/admin/lists/kexec@lists.fedoraproject.org
Thanks
Dave