From: Harald Hoyer Date: Wed, 13 Jan 2010 16:59:14 +0000 (+0100) Subject: lvm: add rd_LVM_LV and "--poll n" X-Git-Tag: 004~11 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dc0a0f6c93a5997183a69e64daf9b5648267a791;p=thirdparty%2Fdracut.git lvm: add rd_LVM_LV and "--poll n" --- diff --git a/dracut.8 b/dracut.8 index c75e0dde9..869c99970 100644 --- a/dracut.8 +++ b/dracut.8 @@ -150,6 +150,11 @@ disable LVM detection .TP .B rd_LVM_VG= only activate the volume groups with the given name +rd_LVM_VG can be specified multiple times on the kernel command line. +.TP +.B rd_LVM_LV= +only activate the volume groups with the given name +rd_LVM_LV can be specified multiple times on the kernel command line. .TP .B rd_NO_LVMCONF remove any /etc/lvm/lvm.conf, which may exist in the initramfs diff --git a/modules.d/90lvm/lvm_scan.sh b/modules.d/90lvm/lvm_scan.sh index 3bf858a85..85cd78e49 100755 --- a/modules.d/90lvm/lvm_scan.sh +++ b/modules.d/90lvm/lvm_scan.sh @@ -5,6 +5,7 @@ . /lib/dracut-lib.sh VGS=$(getargs rd_LVM_VG=) +LVS=$(getargs rd_LVM_LV=) [ -d /etc/lvm ] || mkdir -p /etc/lvm # build a list of devices to scan @@ -31,9 +32,43 @@ if [ ! -e /etc/lvm/lvm.conf ]; then } > /etc/lvm/lvm.conf lvmwritten=1 fi -info "Scanning devices $lvmdevs for LVM volume groups $VGS" -lvm vgscan --ignorelockingfailure 2>&1 | vinfo -lvm vgchange -ay --ignorelockingfailure --monitor n $VGS 2>&1 | vinfo + +check_lvm_ver() { + # --poll is supported since 2.2.57 + [ $1 -lt 2 ] && return 1 + [ $1 -gt 2 ] && return 0 + # major is 2 + [ $2 -lt 2 ] && return 1 + [ $2 -gt 2 ] && return 0 + # minor is 2, check for + # greater or equal 57 + [ $3 -ge 57 ] && return 0 + return 1 +} + +nopoll=$( + # hopefully this output format will never change, e.g.: + # LVM version: 2.02.53(1) (2009-09-25) + lvm version 2>/dev/null | \ + ( + IFS=. read maj min sub; + maj=${maj##*:}; + sub=${sub%% *}; sub=${sub%%\(*}; + check_lvm_ver $maj $min $sub && \ + echo " --poll n ")) + +if [ -n "$LVS" ] ; then + info "Scanning devices $lvmdevs for LVM logical volumes $LVS" + lvm lvscan --ignorelockingfailure 2>&1 | vinfo + lvm lvchange -ay --ignorelockingfailure $nopoll --monitor n $LVS 2>&1 | vinfo +fi + +if [ -z "$LVS" -o -n "$VGS" ]; then + info "Scanning devices $lvmdevs for LVM volume groups $VGS" + lvm vgscan --ignorelockingfailure 2>&1 | vinfo + lvm vgchange -ay --ignorelockingfailure $nopoll --monitor n $VGS 2>&1 | vinfo +fi + if [ "$lvmwritten" ]; then rm -f /etc/lvm/lvm.conf ln -s /sbin/lvm-cleanup /pre-pivot/30-lvm-cleanup.sh 2>/dev/null