Currently in Fedora/RedHat dracut installs its fedora.conf.example
as the default config file, in which sysloglvl is set 5. This leads
to maxloglvl=5 in dracut calls, making unnecessary lsinitrd calls
during initramfs builds.
This patch makes use of --confdir arguments of dracut, creates temp
config directory before mkdumprd(dracut) calls. It appends sysloglvl=3
option by creating a 99-kdump.conf file in the temp config directory.
1) Before this patch
$ kdumpctl stop; touch /etc/kdump.conf; time kdumpctl start
kexec: unloaded kdump kernel
Stopping kdump: [OK]
Detected change(s) in the following file(s):
/etc/kdump.conf
Rebuilding /boot/initramfs-4.13.0-0.rc1.git4.1.fc27.x86_64kdump.img
kexec: loaded kdump kernel
Starting kdump: [OK]
real 0m26.824s
user 0m9.958s
sys 0m15.106s
2) After this patch
$ kdumpctl stop; touch /etc/kdump.conf; time kdumpctl start
kexec: unloaded kdump kernel
Stopping kdump: [OK]
Detected change(s) in the following file(s):
/etc/kdump.conf
Rebuilding /boot/initramfs-4.13.0-0.rc1.git4.1.fc27.x86_64kdump.img
kexec: loaded kdump kernel
Starting kdump: [OK]
real 0m20.420s
user 0m8.385s
sys 0m10.468s
Ziyue Yang (4):
kdumpctl: specify temp config directory for dracut when calling
mkdumprd
kdump-lib.sh: create temp config directory for dracut
kdump.conf: add help text and default value for dracut_sysloglvl
kdump.conf.5: add man text for dracut_sysloglvl
kdump-lib.sh | 24 ++++++++++++++++++++++++
kdump.conf | 4 ++++
kdump.conf.5 | 6 ++++++
kdumpctl | 6 ++++--
4 files changed, 38 insertions(+), 2 deletions(-)
--
2.7.4
Show replies by date
Currently in Fedora/RedHat dracut installs its fedora.conf.example
as the default config file, in which sysloglvl is set 5. This leads
to maxloglvl=5 in dracut calls, making unnecessary lsinitrd calls
during initramfs builds.
To eliminate redundant lsinitrd calls in dracut, we have to
lower the system logging level while mkdumprd call by specifying
new config directory for dracut.
This commit
1) adds --confdir argument in mkdumprd call, using
get_kdumpctl_dracut_confdir to get temp dracut config directory,
where 99-kdump.conf exists;
2) adds the dracut_sysloglvl to valid kdump.conf config values.
Signed-off-by: Ziyue Yang <ziyang(a)redhat.com>
---
kdumpctl | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index b7a3105..0f25764 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -5,7 +5,6 @@ KDUMP_KERNELVER=""
KDUMP_COMMANDLINE=""
KEXEC_ARGS=""
KDUMP_CONFIG_FILE="/etc/kdump.conf"
-MKDUMPRD="/sbin/mkdumprd -f"
SAVE_PATH=/var/crash
SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
INITRD_CHECKSUM_LOCATION="/boot/.fadump_initrd_checksum"
@@ -19,9 +18,12 @@ DEFAULT_DUMP_MODE="kdump"
image_time=0
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
+
. $dracutbasedir/dracut-functions.sh
. /lib/kdump/kdump-lib.sh
+MKDUMPRD="/sbin/mkdumprd --confdir $(get_kdumpctl_dracut_confdir $dracutbasedir)
-f"
+
standard_kexec_args="-p"
# Some default values in case /etc/sysconfig/kdump doesn't include
@@ -410,7 +412,7 @@ check_config()
case "$config_opt" in
\#* | "")
;;
- raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|default|force_rebuild|force_no_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes)
+ raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|default|force_rebuild|force_no_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes|dracut_sysloglvl)
# remove inline comments after the end of a directive.
config_val=$(strip_comments $config_val)
[ -z "$config_val" ] && {
--
2.7.4
In order to add kdump-specified config values to dracut without
default dracut configs, we have to create a temp config directory
while kdump's dracut call, by copying origin config files
to a temp place and add our own config values to 99-kdump.conf.
This commit
1) adds get_dracut_conf to get dracut config values
(now dracut_sysloglvl only) from kdump.conf;
2) adds get_kdumpctl_dracut_confdir to create the temp dracut
config directory, and return the path of it.
Signed-off-by: Ziyue Yang <ziyang(a)redhat.com>
---
kdump-lib.sh | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index 3f0af91..71d8885 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -493,3 +493,27 @@ is_fadump_capable()
fi
return 1
}
+
+get_dracut_conf()
+{
+ echo $(grep "^$1" /etc/kdump.conf |awk '{print $2}')
+}
+
+get_kdumpctl_dracut_confdir()
+{
+ local _tmp_dracut_confdir=/tmp/kdumpctl.dracut.conf.d
+ rm -rf $_tmp_dracut_confdir
+ mkdir -p $_tmp_dracut_confdir
+
+ # copy origin confdir
+ [[ -e $1/dracut.conf.d ]] && cp -rf $1/dracut.conf.d $_tmp_dracut_confdir/
+ [[ -e /etc/dracut.conf.d ]] && cp -rf /etc/dracut.conf.d
$_tmp_dracut_confdir/
+
+ # get dracut conf values in kdump.conf
+ local _dracut_sysloglvl=$(get_dracut_conf dracut_sysloglvl)
+ if [ ! -z "$_dracut_sysloglvl" ]; then
+ echo "sysloglvl=$dracut_sysloglvl" >>
$_tmp_dracut_confdir/dracut.conf.d/99-kdump.conf
+ fi
+
+ echo "$_tmp_dracut_confdir/dracut.conf.d"
+}
--
2.7.4
This commit
1) adds help text for dracut_sysloglvl config item;
2) set dracut_sysloglvl to 3 by default to eliminate redundant
lsinitrd calls in dracut.
Signed-off-by: Ziyue Yang <ziyang(a)redhat.com>
---
kdump.conf | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kdump.conf b/kdump.conf
index 57af7b6..f9663a9 100644
--- a/kdump.conf
+++ b/kdump.conf
@@ -140,6 +140,9 @@
# to send fence_kdump notifications to.
# (this option is mandatory to enable fence_kdump).
#
+# dracut_args <arg(s)>
+# - Pass extra dracut options when rebuilding kdump initrd.
+#
#raw /dev/vg/lv_kdump
#ext4 /dev/vg/lv_kdump
@@ -161,3 +164,4 @@ core_collector makedumpfile -l --message-level 1 -d 31
#dracut_args --omit-drivers "cfg80211 snd" --add-drivers "ext2 ext3"
#fence_kdump_args -p 7410 -f auto -c 0 -i 10
#fence_kdump_nodes node1 node2
+dracut_sysloglvl 3
--
2.7.4
This commit adds man text for dracut_sysloglvl config item in
kdump.conf.
Signed-off-by: Ziyue Yang <ziyang(a)redhat.com>
---
kdump.conf.5 | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/kdump.conf.5 b/kdump.conf.5
index 11b1fad..7b6de0b 100644
--- a/kdump.conf.5
+++ b/kdump.conf.5
@@ -204,6 +204,12 @@ List of cluster node(s) except localhost, separated by spaces, to
send fence_kdu
to (this option is mandatory to enable fence_kdump).
.RE
+.B dracut_sysloglvl <0 - 6>
+.RS
+Control dracut's level of system log. Level 3 is set as default to eliminate
redundant logs for
+dracut image building speed.
+.RE
+
.SH DEPRECATED OPTIONS
--
2.7.4