]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
dracut-functions.sh: catch all lvm slaves
authorHarald Hoyer <harald@redhat.com>
Tue, 9 Aug 2016 13:26:04 +0000 (15:26 +0200)
committerHarald Hoyer <harald@redhat.com>
Fri, 19 Aug 2016 13:49:33 +0000 (15:49 +0200)
add check_vol_slaves_all to be used in check_block_and_slaves_all

otherwise only the first lvm VG member would be processed

(cherry picked from commit 7a7b8c174023886b015bd484372839aecf63f324)

dracut-functions.sh

index 4496bfe6c129e2d09172e4f542c8f21c254429da..249d8fb4b7db325484b241d87e1dc2fc0c0d669e 100755 (executable)
@@ -507,7 +507,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
@@ -580,6 +580,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 <filesystem options> <search for option>
 # search for a specific option in a bunch of filesystem options
 # and return the value