Hi, Pratyush
On 07/14/16 at 10:30am, Pratyush Anand wrote:
Hi Dave,
On 14/07/2016:10:57:11 AM, Dave Young wrote:
> Hi, Pratyush
>
> On 07/14/16 at 10:45am, Dave Young wrote:
> > Hi, Pratyush
> >
> > On 07/13/16 at 01:37pm, Pratyush Anand wrote:
> > > If dracut watchdog module is enabled then, it includes kernel watchdog
> > > module of active watchdog device in initramfs.
> > >
> > > kdump.conf has an option to modify dracut_args. So, if an user passes
"-a
> > > watchdog" in dracut_args then dracut will add kernel watchdog module
of
> > > active watchdog device in initramfs.
> > >
> > > Since, kexec-tools always requires to add kernel watchdog module of
active
> > > watchdog device in initramfs, therefore even when an user does not pass
any
> > > watchdog option then also kexec-tools adds "-a watchdog" in
dracut args.
> > >
> > > Therefore, if an user does not want to add kernel watchdog module in
> > > initramfs then he/she must pass "-o watchdog" in dracut_args.
> > >
> > > Signed-off-by: Pratyush Anand <panand(a)redhat.com>
> > > ---
> > > kdump-lib.sh | 29 +++++++++++++++++++++++++++++
> > > mkdumprd | 5 ++++-
> > > 2 files changed, 33 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/kdump-lib.sh b/kdump-lib.sh
> > > index 141a5614f1d5..bd1d95ea4bfd 100755
> > > --- a/kdump-lib.sh
> > > +++ b/kdump-lib.sh
> > > @@ -382,3 +382,32 @@ get_ifcfg_filename() {
> > >
> > > echo -n "${ifcfg_file}"
> > > }
> > > +
> > > +# returns 0 when omission of watchdog module is desired in dracut_args
> > > +# returns 1 when addition of watchdog module is desired in dracut_args
> > > +# returns 2 when there is no option for watchdog module in dracut_args
> > > +check_wdt_mod_omission() {
> > > + local dracut_args
> > > + local ret=2
> > > +
> > > + dracut_args=$(grep "^dracut_args" /etc/kdump.conf)
> > > + [[ -z $dracut_args ]] && return $ret
> > > +
> > > + eval set -- $dracut_args
> > > + while :; do
> > > + [[ -z $1 ]] && break
> > > + case $1 in
> > > + -o|--omit)
> > > + echo $2 | grep -qw "watchdog"
> > > + [[ $? == 0 ]] && ret=0
> > > + shift;;
> > > + -a|--add)
> > > + echo $2 | grep -qw "watchdog"
> > > + [[ $? == 0 ]] && ret=1
> > > + shift;;
> > > + esac
> > > + shift
> > > + done
> > > +
> > > + return $ret
> > > +}
> >
> > It looks over complex.
> >
> > I did below test:
> >
> > dracut -H -f a.img --printsize `uname -r`
> > - no watchdog added
> >
> > dracut -a watchdog -o watchdog -H -f a.img --printsize `uname -r`
> > - no watchdog added
> >
> > dracut -o watchdog -a watchdog -H -f a.img --printsize `uname -r`
> > - no watchdog added
> >
> > dracut -a watchdog -H -f a.img --printsize `uname -r`
> > - watchdog being added
> >
> > What ever options if one use -o watchdog in dracut_args the "-a"
will
> > be discarded. So how about just add -a watchdog in code if needed and
> > add a code comment that dracut_args options "-o watchdog" will
overwrite
> > the "-a watchdog"? If one specify -a watchdog in dracut_args it does
not
> > matter as well
>
> BTW, watchdog should be added when there is active watchdog in 1st kernel
It is still same.
When we pass "-a watchdog" in dracut_args, only dracut watchdog module is
added.
kernel watchdog driver will be added by dracut only when there will be active
watchdog.
Right for kernel drivers but dracut will still install useless scripts..
> Ideally we can do that in dracut module check() function (hostonly case) so
> we do not need anything in our code to check it. What do you think?
You meant that even when one adds dracut watchdog module, check() should not
pass if there was not active watchdog?
I am not sure if that is possible. We can confirm from Harald. My understanding
is that if one adds module with "-a watchdog", that takes precedence over
check() function.
Not sure if it would be acceptable to dracut, if we modify check() for default
option, so that check() returns success in case of active watchdog is present.
Just for hostonly mode it should be fine, but check with Harald will be
better..
>
> ~Pratyush
> >
> > >
> > > > diff --git a/mkdumprd b/mkdumprd
> > > > index eb0d5e06fac9..f964940555ee 100644
> > > > --- a/mkdumprd
> > > > +++ b/mkdumprd
> > > > @@ -16,8 +16,11 @@ SAVE_PATH=$(grep ^path $conf_file| cut -d'
' -f2)
> > > > # strip the duplicated "/"
> > > > SAVE_PATH=$(echo $SAVE_PATH | tr -s /)
> > > >
> > > > +check_wdt_mod_omission
> > > > +[[ $? -eq 2 ]] && WDTCFG="-a watchdog"
> > > > +
> > > > extra_modules=""
> > > > -dracut_args=("--hostonly" "-o" "plymouth
dash resume ifcfg")
> > > > +dracut_args=("--hostonly" "-o" "plymouth
dash resume ifcfg" $WDTCFG)
> > > > OVERRIDE_RESETTABLE=0
> > > >
> > > > add_dracut_arg() {
> > > > --
> > > > 2.5.5
> > > > _______________________________________________
> > > > kexec mailing list
> > > > kexec(a)lists.fedoraproject.org
> > > >
https://lists.fedoraproject.org/admin/lists/kexec@lists.fedoraproject.org
> > >
> > > Thanks
> > > Dave
> >
> > Thanks
> > Dave
> _______________________________________________
> kexec mailing list
> kexec(a)lists.fedoraproject.org
>
https://lists.fedoraproject.org/admin/lists/kexec@lists.fedoraproject.org