Currentl kdump_get_persistent_dev just call dracut's get_persistent_dev, but dracut's get_persistent_dev will call dracut's get_maj_min which need caller to do extra setup work. dracut function can keep changing in the future, so make kdump-lib.sh's kdump_get_persistent_dev independent to dracut change.
The new added function code are just copied from dracut with converting get_maj_min call to kdump_get_maj_min.
Signed-off-by: Kairui Song kasong@redhat.com --- kdump-lib.sh | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index d32871a..f08fa5a 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -318,9 +318,38 @@ get_option_value() { }
kdump_get_persistent_dev() { - local dev=$(to_dev_name $1) + local _dev i _tmp _pol
- echo $(get_persistent_dev "$dev") + _dev=$(to_dev_name $1) + _dev=$(kdump_get_maj_min "$1") + + [ -z "$_dev" ] && return + + if [[ -n $persistent_policy ]]; then + _pol="/dev/disk/${persistent_policy}/*" + else + _pol= + fi + + for i in \ + $_pol \ + /dev/mapper/* \ + /dev/disk/by-uuid/* \ + /dev/disk/by-label/* \ + /dev/disk/by-partuuid/* \ + /dev/disk/by-partlabel/* \ + /dev/disk/by-id/* \ + /dev/disk/by-path/*; do + [[ -e $i ]] || continue + [[ $i == /dev/mapper/control ]] && continue + [[ $i == /dev/mapper/mpath* ]] && continue + _tmp=$(kdump_get_maj_min "$i") + if [ "$_tmp" = "$_dev" ]; then + printf -- "%s" "$i" + return + fi + done + printf -- "%s" "$1" }
is_ipv6_address()