Yes, it is not worth to add so much code for this. Maybe use "dracut -q"On 08/22/17 at 09:14am, Xunlei Pang wrote:
> On 08/21/2017 at 03:35 PM, Ziyue Yang wrote:
> > 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 when there is no need
> > for the logs, we create a new kdump.conf option, dracut_sysloglvl, and
> > set its default value to level 3 to control dracut's sysloglvl option.
> > See dracut.conf(5).
> >
> > On the other hand, to add kdump-specified config values to dracut
> > instead of 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, dracut_sysloglvl in
> > this case, to 99-kdump.conf.
> >
> > This commit
> > 1) adds the dracut_sysloglvl to valid kdump.conf config value set;
> > 2) set dracut_sysloglvl to level 3 as default in kdump.conf;
> > 2) adds create_kdump_dracut_confdir to create the temp dracut
> > config directory, and return the path of it;
> > 3) adds --confdir to mkdumprd call, using the result from
> > create_kdump_dracut_confdir.
> >
> > Signed-off-by: Ziyue Yang <ziyang@redhat.com>
> > ---
> > kdump-lib.sh | 19 +++++++++++++++++++
> > kdump.conf | 1 +
> > kdumpctl | 5 +++--
> > 3 files changed, 23 insertions(+), 2 deletions(-)
> >
> > diff --git a/kdump-lib.sh b/kdump-lib.sh
> > index 3f0af91..cfeb4c0 100755
> > --- a/kdump-lib.sh
> > +++ b/kdump-lib.sh
> > @@ -493,3 +493,22 @@ is_fadump_capable()
> > fi
> > return 1
> > }
> > +
> > +create_kdump_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_option_value 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"
> > +}
> > diff --git a/kdump.conf b/kdump.conf
> > index 57af7b6..011c2ba 100644
> > --- a/kdump.conf
> > +++ b/kdump.conf
> > @@ -161,3 +161,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
>
> Hi Ziyue,
>
> I bet Dave won't like introducing this new directive in kdump.conf, as a
> rule of thumb, we should avoid new directives as possible as we can.
>
> I think we don't care about the syslog very much, so I am fine with a
> hard-coded one.
see --quiet works or not, if not sending a dracut patch to skip the
lsinitrd in case --quiet.
> ______________________________
>
> Regards,
> Xunlei
>
> > diff --git a/kdumpctl b/kdumpctl
> > index b7a3105..2608ec8 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"
> > @@ -22,6 +21,8 @@ image_time=0
> > . $dracutbasedir/dracut-functions.sh
> > . /lib/kdump/kdump-lib.sh
> >
> > +MKDUMPRD="/sbin/mkdumprd --confdir $(create_kdump_dracut_confdir $dracutbasedir) -f"
> > +
> > standard_kexec_args="-p"
> >
> > # Some default values in case /etc/sysconfig/kdump doesn't include
> > @@ -410,7 +411,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" ] && {
_________________
> kexec mailing list -- kexec@lists.fedoraproject.org
> To unsubscribe send an email to kexec-leave@lists.fedoraproject.org
Thanks
Dave