summaryrefslogtreecommitdiff
path: root/dracut-functions
diff options
context:
space:
mode:
authorHarald Hoyer <harald@redhat.com>2009-08-31 14:58:44 +0200
committerHarald Hoyer <harald@redhat.com>2009-09-01 15:42:28 +0200
commit533d7dc4ab642008a53c7bd681724ffcbd426426 (patch)
tree8d7c7637b8227e4f50ecf506a9293bdd7bc12201 /dracut-functions
parentec74fa8789453a7949869947ba07e66b27e24512 (diff)
downloaddracut-533d7dc4ab642008a53c7bd681724ffcbd426426.tar.gz
dracut-533d7dc4ab642008a53c7bd681724ffcbd426426.tar.bz2
dracut-533d7dc4ab642008a53c7bd681724ffcbd426426.zip
dracut-function: add check for volume group members
see https://bugzilla.redhat.com/show_bug.cgi?id=506189 not all members of a linear volume group are listed in /sys slaves
Diffstat (limited to 'dracut-functions')
-rwxr-xr-xdracut-functions30
1 files changed, 30 insertions, 0 deletions
diff --git a/dracut-functions b/dracut-functions
index ffb03b71..7544fc6b 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -91,6 +91,7 @@ check_block_and_slaves() {
local x
[[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
"$1" $2 && return
+ check_vol_slaves "$@" && return 0
[[ -d /sys/dev/block/$2/slaves ]] || return 1
for x in /sys/dev/block/$2/slaves/*/dev; do
[[ -f $x ]] || continue
@@ -99,6 +100,35 @@ check_block_and_slaves() {
return 1
}
+get_numeric_dev() {
+ ls -lH "$1" | { read a b c d maj min rest; printf "%d:%d" ${maj%%,} $min;}
+}
+
+# ugly workaround for the lvm design
+# There is no volume group device,
+# so, there are no slave devices for volume groups.
+# Logical volumes only have the slave devices they really live on,
+# but you cannot create the logical volume without the volume group.
+# And the volume group might be bigger than the devices the LV needes.
+check_vol_slaves() {
+ for i in /dev/mapper/*; do
+ lv=$(get_numeric_dev $i)
+ if [[ $lv = $2 ]]; then
+ vg=$(lvs --noheadings -o vg_name $i 2>/dev/null)
+ # strip space
+ vg=$(echo $vg)
+ if [[ $vg ]]; then
+ for pv in $(vgs --noheadings -o pv_name "$vg" 2>/dev/null); \
+ do
+ check_block_and_slaves $1 $(get_numeric_dev $pv) \
+ && return 0
+ done
+ fi
+ fi
+ done
+ return 1
+}
+
# $1 = file to copy to ramdisk
# $2 (optional) Name for the file on the ramdisk
# Location of the image dir is assumed to be $initdir