From 7a7b8c174023886b015bd484372839aecf63f324 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Tue, 9 Aug 2016 15:26:04 +0200 Subject: [PATCH] dracut-functions.sh: catch all lvm slaves add check_vol_slaves_all to be used in check_block_and_slaves_all otherwise only the first lvm VG member would be processed --- dracut-functions.sh | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/dracut-functions.sh b/dracut-functions.sh index 4a9729c7..61726e44 100755 --- a/dracut-functions.sh +++ b/dracut-functions.sh @@ -632,7 +632,7 @@ check_block_and_slaves_all() { if ! lvm_internal_dev $2 && "$1" $2; then _ret=0 fi - check_vol_slaves "$@" && return 0 + check_vol_slaves_all "$@" && return 0 if [[ -f /sys/dev/block/$2/../dev ]]; then check_block_and_slaves_all $1 $(<"/sys/dev/block/$2/../dev") && _ret=0 fi @@ -703,6 +703,29 @@ check_vol_slaves() { return 1 } +check_vol_slaves_all() { + local _lv _vg _pv + for i in /dev/mapper/*; do + [[ $i == /dev/mapper/control ]] && continue + _lv=$(get_maj_min $i) + if [[ $_lv = $2 ]]; then + _vg=$(lvm lvs --noheadings -o vg_name $i 2>/dev/null) + # strip space + _vg="${_vg//[[:space:]]/}" + if [[ $_vg ]]; then + for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2>/dev/null) + do + check_block_and_slaves_all $1 $(get_maj_min $_pv) + done + return 0 + fi + fi + done + return 1 +} + + + # fs_get_option # search for a specific option in a bunch of filesystem options # and return the value