On 11/14/16 at 12:17pm, Xunlei Pang wrote:
On 2016/11/11 at 12:54, Dave Young wrote:
> We maintained kdump specific get persistent dev function, it is ready to drop it.
> Dracut upstream splitted dracut init stuff from dracut-functions.sh so that we
> can source it.
>
> OTOH, dracut now has a persistent_policy feature, for kdump when we dump to
> raw disks we do not care the filesystem uuid and labels so we prefer to search
> disk id instead. Set the persistent_policy before calling get_persistent_dev will
> ensure kdump logic still works.
>
> Tested filesystem and raw dump in kvm guests.
>
> Signed-off-by: Dave Young <dyoung(a)redhat.com>
> ---
> kdump-lib.sh | 26 --------------------------
> kdumpctl | 8 +++++++-
> mkdumprd | 10 ++++++----
> 3 files changed, 13 insertions(+), 31 deletions(-)
>
> --- kexec-tools.orig/kdump-lib.sh
> +++ kexec-tools/kdump-lib.sh
> @@ -88,32 +88,6 @@ to_dev_name() {
> echo $dev
> }
>
> -kdump_get_persistent_dev() {
> - local i _tmp _dev _lookup_dirs
> -
> - _dev=$(udevadm info --query=name --name="$1" 2>/dev/null)
> - [ -z "$_dev" ] && {
> - perror_exit "Kernel dev name of $1 is not found."
> - }
> -
> - if [[ $2 = "raw" ]];then
> - _lookup_dirs="/dev/mapper/* /dev/disk/by-id/*"
> - else
> - _lookup_dirs="/dev/mapper/* /dev/disk/by-uuid/* /dev/disk/by-id/*"
> - fi
> -
> - for i in $_lookup_dirs; do
> - _tmp=$(udevadm info --query=name --name="$i" 2>/dev/null)
> - if [ "$_tmp" = "$_dev" ]; then
> - echo $i
> - return
> - fi
> - done
> -
> - perror "WARNING: Persistent device name of $1 not found. Using $1 as dump
target name"
> - echo $1
> -}
> -
> get_user_configured_dump_disk()
> {
> local _target
> --- kexec-tools.orig/kdumpctl
> +++ kexec-tools/kdumpctl
> @@ -16,6 +16,8 @@ FADUMP_REGISTER_SYS_NODE="/sys/kernel/fa
> DEFAULT_DUMP_MODE="kdump"
> image_time=0
>
> +[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
> +. $dracutbasedir/dracut-functions.sh
> . /lib/kdump/kdump-lib.sh
>
> standard_kexec_args="-p"
> @@ -416,7 +418,11 @@ check_dump_fs_modified()
> if [[ $(expr substr $_new_fstype 1 3) = "nfs" ]];then
> _new_dev=$_target
> else
> - _new_dev=$(kdump_get_persistent_dev $_target $_new_fstype)
> + _new_dev=$(get_persistent_dev $_target)
> + if [ -z "$_new_dev" ]; then
> + echo "Get persistent device name failed"
> + return 2
> + fi
> fi
>
> if ! findmnt $_target >/dev/null; then
> --- kexec-tools.orig/mkdumprd
> +++ kexec-tools/mkdumprd
> @@ -6,6 +6,8 @@
> # Written by Cong Wang <amwang(a)redhat.com>
> #
>
> +[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
> +. $dracutbasedir/dracut-functions.sh
There are two different versions of get_maj_min(): one is in /mkdumprd, another is in
dracut-functions.sh
We should do a cleanup to ensure consistency.
Good catch, I'm retesting, will send an update to drop get_maj_min as
well.
Thanks
Dave
>
> Regards,
> Xunlei
>
> > . /lib/kdump/kdump-lib.sh
> > export IN_KDUMP=1
> >
> > @@ -127,8 +129,8 @@ to_mount() {
> > _mntopts="$_target $_fstype $_options"
> > #for non-nfs _dev converting to use udev persistent name
> > if [ -b "$_source" ]; then
> > - _pdev="$(kdump_get_persistent_dev $_source $_fstype)"
> > - if [ $? -ne 0 ]; then
> > + _pdev="$(get_persistent_dev $_source)"
> > + if [ -z "$_pdev" ]; then
> > return 1
> > fi
> >
> > @@ -532,8 +534,8 @@ do
> > dd if=$config_val count=1 of=/dev/null > /dev/null 2>&1 || {
> > perror_exit "Bad raw disk $config_val"
> > }
> > - _praw=$(kdump_get_persistent_dev $config_val "raw")
> > - if [ $? -ne 0 ]; then
> > + _praw=$(persistent_policy="by-id" get_persistent_dev
$config_val)
> > + if [ -z "$_praw" ]; then
> > exit 1
> > fi
> > add_dracut_arg "--device" "$_praw"
> > _______________________________________________
> > kexec mailing list -- kexec(a)lists.fedoraproject.org
> > To unsubscribe send an email to kexec-leave(a)lists.fedoraproject.org
>