On 07/03/17 at 02:35pm, Xunlei Pang wrote:
> On 07/03/2017 at 01:52 PM, Dave Young wrote:
> > Hi Xunlei,
> > On 06/30/17 at 11:18am, Xunlei Pang wrote:
> >> Resolves: bz1451717
> >>
https://bugzilla.redhat.com/1451717
> >>
> >> When there is any "rd.lvm.lv=X", "lvm" dracut module
will
> >> try to recognize all the lvm volumes which is unnecessary
> >> and probably cause trouble for us.
> >>
> >> See
https://bugzilla.redhat.com/show_bug.cgi?id=1451717#c2
> >>
> >> Remove all the rd.lvm.lv=X inherited from the kernel cmdline,
> >> and generate the corresponding cmdline as needed.
> >>
> >> Currently, we don't handle "rd.lvm.vg=X", we can add it in
> >> when there is some bug reported in the future.
> >>
> >> Signed-off-by: Xunlei Pang <xlpang(a)redhat.com>
> >> ---
> >> kdumpctl | 40 ++++++++++++++++++++++++++++++++++++++++
> >> 1 file changed, 40 insertions(+)
> >>
> >> diff --git a/kdumpctl b/kdumpctl
> >> index 221b461..7cbef2e 100755
> >> --- a/kdumpctl
> >> +++ b/kdumpctl
> >> @@ -176,6 +176,42 @@ is_dump_to_rootfs()
> >> grep "^default[[:space:]]dump_to_rootfs" /etc/kdump.conf
>/dev/null
> >> }
> >>
> >> +# Generate rd.lvm.lv=X for the kdump targets if any.
> >> +generate_lvm_cmdline()
> >> +{
> >> + local dev=$1
> >> + local vg lv cmdline dir_s dev_s
> >> +
> >> + ! [ -b $dev ] && return
> >> +
> >> + vg=$(lvm lvs --rows $dev -o vg_name --separator=* 2>/dev/null | cut -d
"*" -f 2)
> >> + lv=$(lvm lvs --rows $dev -o lv_name --separator=* 2>/dev/null | cut -d
"*" -f 2)
> >> + if [ -n "$vg" -a -n "$lv" ]; then
> >> + cmdline="rd.lvm.lv=$vg/$lv"
> >> + fi
> >> +
> >> + dev=$(get_maj_min $dev)
> >> + [[ -d /sys/dev/block/$dev/slaves ]] || return
> >> + for dir_s in /sys/dev/block/$dev/slaves/*; do
> >> + dev_s=$(< "$dir_s/dev")
> >> + dev_s=$(get_persistent_dev dev_s)
> >> + cmdline="$cmdline $(generate_lvm_cmdline $dev_s)"
> >> + done
> >> +
> >> + [ -n "$cmdline" ] && echo "$cmdline"
> >> +}
> >> +
> >> +generate_lvm_cmdlines()
> >> +{
> >> + local target cmdlines
> >> +
> >> + for target in "$KDUMP_TARGETS"; do
> >> + cmdlines="$cmdlines $(generate_lvm_cmdline $target)"
> >> + done
> > Can we use the "for_each_block_target" function for this?
>
> I thought about it before, but I didn't find a good way to pass back
> the generated cmdline without using tmp file or shared variables.
> Do you have any good idea?
for_each_block_target is using check_block_and_slaves which will return
as long as condition matches. For this cmdline case we need iterate all
items so should try check_block_and_slaves_all instead. Maybe like in
dracut.sh for collecting all the host_fs_types. I do not try it just an
idea.
About passing the cmdline, does a shared variables work? like the
host_fs_types in dracut..
Hmm, I actually means not sharing things between files, ie.
for_each_xxx function $param
the function should be defined in kdumpctl then it can use any vars
defined in kdumpctl so no need share anything?
>
> >
> > Regards,
> > Xunlei
> >
>
> Thanks
> Dave
> _______________________________________________
> kexec mailing list -- kexec(a)lists.fedoraproject.org
> To unsubscribe send an email to kexec-leave(a)lists.fedoraproject.org