Blame SOURCES/0002-Kdump-parse-auto_reset_crashkernel-754.patch

95d751
From e0bce2e8c21ccc69729676e8dc6fa1e541aedee2 Mon Sep 17 00:00:00 2001
95d751
From: Laszlo Ersek <lersek@users.noreply.github.com>
95d751
Date: Wed, 20 Apr 2022 10:13:06 +0200
d2e6db
Subject: [PATCH 2/3] Kdump: parse "auto_reset_crashkernel" (#754)
95d751
95d751
The "auto_reset_crashkernel" keyword was introduced in the following
95d751
kexec-tools patch set:
95d751
95d751
  [PATCH v5 00/13] crashkernel=auto: support fadump and remove
95d751
                   crashkernel.default
95d751
  https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org/thread/V5WPTRAPJR65QXSTNW6W6E7ZBAUCQNUH/#V5WPTRAPJR65QXSTNW6W6E7ZBAUCQNUH
95d751
95d751
Related upstream commit:
95d751
95d751
  https://src.fedoraproject.org/rpms/kexec-tools/c/73ced7f451a72
95d751
95d751
Recognize "auto_reset_crashkernel" in "kdump.aug". Update the test case.
95d751
Also copy "kdump.conf" from kexec-tools @ 73ced7f451a72 to
95d751
"tests/root/etc/kdump.conf".
95d751
95d751
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2042772
95d751
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
95d751
(cherry picked from commit 288a028da531a5f58d9ee89bc29fd73e7483bf24)
95d751
---
95d751
 lenses/kdump.aug            |   4 +
95d751
 lenses/tests/test_kdump.aug |   2 +
95d751
 tests/root/etc/kdump.conf   | 192 ++++++++++++++++++++++++++++++++++++
95d751
 3 files changed, 198 insertions(+)
95d751
 create mode 100644 tests/root/etc/kdump.conf
95d751
95d751
diff --git a/lenses/kdump.aug b/lenses/kdump.aug
95d751
index ddf50ede..e50486c3 100644
95d751
--- a/lenses/kdump.aug
95d751
+++ b/lenses/kdump.aug
95d751
@@ -25,6 +25,7 @@ let empty = Util.empty
95d751
 let comment = Util.comment
95d751
 let value_to_eol = store /[^ \t\n#][^\n#]*[^ \t\n#]|[^ \t\n#]/
95d751
 let int_to_eol = store Rx.integer
95d751
+let yn_to_eol = store ("yes" | "no")
95d751
 let delimiter = Util.del_ws_spc
95d751
 let eol = Util.eol
95d751
 let value_to_spc = store Rx.neg1
95d751
@@ -64,9 +65,12 @@ let simple_kws = "raw" | "net" | "path" | "core_collector" | "kdump_post"
95d751
 let int_kws = "force_rebuild" | "override_resettable" | "debug_mem_level"
95d751
             | "link_delay" | "disk_timeout"
95d751
 
95d751
+let yn_kws = "auto_reset_crashkernel"
95d751
+
95d751
 let option = Build.key_value_line_comment ( simple_kws | fs_types )
95d751
                                           delimiter value_to_eol comment
95d751
            | Build.key_value_line_comment int_kws delimiter int_to_eol comment
95d751
+           | Build.key_value_line_comment yn_kws delimiter yn_to_eol comment
95d751
            | list "extra_bins"
95d751
            | list "extra_modules"
95d751
            | list "blacklist"
95d751
diff --git a/lenses/tests/test_kdump.aug b/lenses/tests/test_kdump.aug
95d751
index 51c79a38..ff82af05 100644
95d751
--- a/lenses/tests/test_kdump.aug
95d751
+++ b/lenses/tests/test_kdump.aug
95d751
@@ -11,6 +11,7 @@ module Test_Kdump =
95d751
 #comment after empty line
95d751
 #
95d751
 #comment after empty comment
95d751
+auto_reset_crashkernel yes
95d751
 path /var/crash  #comment after entry
95d751
 core_collector makedumpfile -c
95d751
 default poweroff
95d751
@@ -49,6 +50,7 @@ blacklist gfs2
95d751
     { "#comment" = "comment after empty line" }
95d751
     {  }
95d751
     { "#comment" = "comment after empty comment" }
95d751
+    { "auto_reset_crashkernel" = "yes" }
95d751
     { "path" = "/var/crash"
95d751
       { "#comment" = "comment after entry" } }
95d751
     { "core_collector" = "makedumpfile -c" }
95d751
diff --git a/tests/root/etc/kdump.conf b/tests/root/etc/kdump.conf
95d751
new file mode 100644
95d751
index 00000000..d4fc78b0
95d751
--- /dev/null
95d751
+++ b/tests/root/etc/kdump.conf
95d751
@@ -0,0 +1,192 @@
95d751
+# This file contains a series of commands to perform (in order) in the kdump
95d751
+# kernel after a kernel crash in the crash kernel(1st kernel) has happened.
95d751
+#
95d751
+# Directives in this file are only applicable to the kdump initramfs, and have
95d751
+# no effect once the root filesystem is mounted and the normal init scripts are
95d751
+# processed.
95d751
+#
95d751
+# Currently, only one dump target and path can be specified.  If the dumping to
95d751
+# the configured target fails, the failure action which can be configured via
95d751
+# the "failure_action" directive will be performed.
95d751
+#
95d751
+# Supported options:
95d751
+#
95d751
+# auto_reset_crashkernel <yes|no>
95d751
+#           - whether to reset kernel crashkernel to new default value
95d751
+#             or not when kexec-tools updates the default crashkernel value and
95d751
+#             existing kernels using the old default kernel crashkernel value.
95d751
+#             The default value is yes.
95d751
+#
95d751
+# raw <partition>
95d751
+#           - Will dd /proc/vmcore into <partition>.
95d751
+#             Use persistent device names for partition devices,
95d751
+#             such as /dev/vg/<devname>.
95d751
+#
95d751
+# nfs <nfs mount>
95d751
+#           - Will mount nfs to <mnt>, and copy /proc/vmcore to
95d751
+#             <mnt>/<path>/%HOST-%DATE/, supports DNS.
95d751
+#
95d751
+# ssh <user@server>
95d751
+#           - Will save /proc/vmcore to <user@server>:<path>/%HOST-%DATE/,
95d751
+#             supports DNS.
95d751
+#             NOTE: make sure the user has write permissions on the server.
95d751
+#
95d751
+# sshkey <path>
95d751
+#           - Will use the sshkey to do ssh dump.
95d751
+#             Specify the path of the ssh key to use when dumping
95d751
+#             via ssh. The default value is /root/.ssh/kdump_id_rsa.
95d751
+#
95d751
+# <fs type> <partition>
95d751
+#           - Will mount -t <fs type> <partition> <mnt>, and copy
95d751
+#             /proc/vmcore to <mnt>/<path>/%HOST_IP-%DATE/.
95d751
+#             NOTE: <partition> can be a device node, label or uuid.
95d751
+#             It's recommended to use persistent device names
95d751
+#             such as /dev/vg/<devname>.
95d751
+#             Otherwise it's suggested to use label or uuid.
95d751
+#
95d751
+# path <path>
95d751
+#           - "path" represents the file system path in which vmcore
95d751
+#             will be saved.  If a dump target is specified in
95d751
+#             kdump.conf, then "path" is relative to the specified
95d751
+#             dump target.
95d751
+#
95d751
+#             Interpretation of "path" changes a bit if the user didn't
95d751
+#             specify any dump target explicitly in kdump.conf.  In this
95d751
+#             case, "path" represents the absolute path from root. The
95d751
+#             dump target and adjusted path are arrived at automatically
95d751
+#             depending on what's mounted in the current system.
95d751
+#
95d751
+#             Ignored for raw device dumps.  If unset, will use the default
95d751
+#             "/var/crash".
95d751
+#
95d751
+# core_collector <command> <options>
95d751
+#           - This allows you to specify the command to copy
95d751
+#             the vmcore.  The default is makedumpfile, which on
95d751
+#             some architectures can drastically reduce vmcore size.
95d751
+#             See /sbin/makedumpfile --help for a list of options.
95d751
+#             Note that the -i and -g options are not needed here,
95d751
+#             as the initrd will automatically be populated with a
95d751
+#             config file appropriate for the running kernel.
95d751
+#             The default core_collector for raw/ssh dump is:
95d751
+#             "makedumpfile -F -l --message-level 7 -d 31".
95d751
+#             The default core_collector for other targets is:
95d751
+#             "makedumpfile -l --message-level 7 -d 31".
95d751
+#
95d751
+#             "makedumpfile -F" will create a flattened vmcore.
95d751
+#             You need to use "makedumpfile -R" to rearrange the dump data to
95d751
+#             a normal dumpfile readable with analysis tools.  For example:
95d751
+#             "makedumpfile -R vmcore < vmcore.flat".
95d751
+#
95d751
+#             For core_collector format details, you can refer to
95d751
+#             kexec-kdump-howto.txt or kdump.conf manpage.
95d751
+#
95d751
+# kdump_post <binary | script>
95d751
+#           - This directive allows you to run a executable binary
95d751
+#             or script after the vmcore dump process terminates.
95d751
+#             The exit status of the current dump process is fed to
95d751
+#             the executable binary or script as its first argument.
95d751
+#             All files under /etc/kdump/post.d are collectively sorted
95d751
+#             and executed in lexical order, before binary or script
95d751
+#             specified kdump_post parameter is executed.
95d751
+#
95d751
+# kdump_pre <binary | script>
95d751
+#           - Works like the "kdump_post" directive, but instead of running
95d751
+#             after the dump process, runs immediately before it.
95d751
+#             Exit status of this binary is interpreted as follows:
95d751
+#               0 - continue with dump process as usual
95d751
+#               non 0 - run the final action (reboot/poweroff/halt)
95d751
+#             All files under /etc/kdump/pre.d are collectively sorted and
95d751
+#             executed in lexical order, after binary or script specified
95d751
+#             kdump_pre parameter is executed.
95d751
+#             Even if the binary or script in /etc/kdump/pre.d directory
95d751
+#             returns non 0 exit status, the processing is continued.
95d751
+#
95d751
+# extra_bins <binaries | shell scripts>
95d751
+#           - This directive allows you to specify additional binaries or
95d751
+#             shell scripts to be included in the kdump initrd.
95d751
+#             Generally they are useful in conjunction with a kdump_post
95d751
+#             or kdump_pre binary or script which depends on these extra_bins.
95d751
+#
95d751
+# extra_modules <module(s)>
95d751
+#           - This directive allows you to specify extra kernel modules
95d751
+#             that you want to be loaded in the kdump initrd.
95d751
+#             Multiple modules can be listed, separated by spaces, and any
95d751
+#             dependent modules will automatically be included.
95d751
+#
95d751
+# failure_action <reboot | halt | poweroff | shell | dump_to_rootfs>
95d751
+#           - Action to perform in case dumping fails.
95d751
+#             reboot:   Reboot the system.
95d751
+#             halt:     Halt the system.
95d751
+#             poweroff: Power down the system.
95d751
+#             shell:    Drop to a bash shell.
95d751
+#                       Exiting the shell reboots the system by default,
95d751
+#                       or perform "final_action".
95d751
+#             dump_to_rootfs:  Dump vmcore to rootfs from initramfs context and
95d751
+#                       reboot by default or perform "final_action".
95d751
+#                       Useful when non-root dump target is specified.
95d751
+#             The default option is "reboot".
95d751
+#
95d751
+# default <reboot | halt | poweroff | shell | dump_to_rootfs>
95d751
+#           - Same as the "failure_action" directive above, but this directive
95d751
+#             is obsolete and will be removed in the future.
95d751
+#
95d751
+# final_action <reboot | halt | poweroff>
95d751
+#           - Action to perform in case dumping succeeds. Also performed
95d751
+#             when "shell" or "dump_to_rootfs" failure action finishes.
95d751
+#             Each action is same as the "failure_action" directive above.
95d751
+#             The default is "reboot".
95d751
+#
95d751
+# force_rebuild <0 | 1>
95d751
+#           - By default, kdump initrd will only be rebuilt when necessary.
95d751
+#             Specify 1 to force rebuilding kdump initrd every time when kdump
95d751
+#             service starts.
95d751
+#
95d751
+# force_no_rebuild <0 | 1>
95d751
+#           - By default, kdump initrd will be rebuilt when necessary.
95d751
+#             Specify 1 to bypass rebuilding of kdump initrd.
95d751
+#
95d751
+#             force_no_rebuild and force_rebuild options are mutually
95d751
+#             exclusive and they should not be set to 1 simultaneously.
95d751
+#
95d751
+# override_resettable <0 | 1>
95d751
+#           - Usually an unresettable block device can't be a dump target.
95d751
+#             Specifying 1 when you want to dump even though the block
95d751
+#             target is unresettable
95d751
+#             By default, it is 0, which will not try dumping destined to fail.
95d751
+#
95d751
+# dracut_args <arg(s)>
95d751
+#           - Pass extra dracut options when rebuilding kdump initrd.
95d751
+#
95d751
+# fence_kdump_args <arg(s)>
95d751
+#           - Command line arguments for fence_kdump_send (it can contain
95d751
+#             all valid arguments except hosts to send notification to).
95d751
+#
95d751
+# fence_kdump_nodes <node(s)>
95d751
+#           - List of cluster node(s) except localhost, separated by spaces,
95d751
+#             to send fence_kdump notifications to.
95d751
+#             (this option is mandatory to enable fence_kdump).
95d751
+#
95d751
+
95d751
+#raw /dev/vg/lv_kdump
95d751
+#ext4 /dev/vg/lv_kdump
95d751
+#ext4 LABEL=/boot
95d751
+#ext4 UUID=03138356-5e61-4ab3-b58e-27507ac41937
95d751
+#nfs my.server.com:/export/tmp
95d751
+#nfs [2001:db8::1:2:3:4]:/export/tmp
95d751
+#ssh user@my.server.com
95d751
+#ssh user@2001:db8::1:2:3:4
95d751
+#sshkey /root/.ssh/kdump_id_rsa
95d751
+auto_reset_crashkernel yes
95d751
+path /var/crash
95d751
+core_collector makedumpfile -l --message-level 7 -d 31
95d751
+#core_collector scp
95d751
+#kdump_post /var/crash/scripts/kdump-post.sh
95d751
+#kdump_pre /var/crash/scripts/kdump-pre.sh
95d751
+#extra_bins /usr/bin/lftp
95d751
+#extra_modules gfs2
95d751
+#failure_action shell
95d751
+#force_rebuild 1
95d751
+#force_no_rebuild 1
95d751
+#dracut_args --omit-drivers "cfg80211 snd" --add-drivers "ext2 ext3"
95d751
+#fence_kdump_args -p 7410 -f auto -c 0 -i 10
95d751
+#fence_kdump_nodes node1 node2
95d751
-- 
95d751
2.31.1
95d751