[readonly/geninitrd: 464/1068] - add dm-multipath component devices to lvm2 ignore list

draenog draenog at pld-linux.org
Sat Nov 2 19:51:23 CET 2013


commit 6b01392905c570d8812a17405f189b7cca1d3703
Author: Elan Ruusamäe <glen at pld-linux.org>
Date:   Wed Oct 24 19:13:56 2007 +0000

    - add dm-multipath component devices to lvm2 ignore list
    
    svn-id: @8860

 geninitrd | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/geninitrd b/geninitrd
index 192be4c..b99774d 100755
--- a/geninitrd
+++ b/geninitrd
@@ -57,8 +57,9 @@ PROBESTATICMODULES=no
 tmpfs_dev=no
 # is /proc/devices entries already created
 proc_partitions=no
-# dmraid component devices of rootfs is on dmraid
-dmraid_devices=''
+
+# LVM devices that should not be included in vgscan on initrd
+lvm_ignore_devieces=''
 
 # if we should init NFS at boot
 have_nfs=no
@@ -540,6 +541,7 @@ find_modules_multipath() {
 	local dev phydevs=$(echo "$info" | awk '$2 ~ /^[0-9]+:[0-9]+:[0-9]+:[0-9]+$/{printf("/dev/%s\n", $3)}')
 	for dev in $phydevs; do
 		find_modules_for_device $dev
+		lvm_ignore_devices="$lvm_ignore_devices $dev"
 	done
 
 	local hw hwhandlers=$(echo "$info" | awk '/hwhandler=1/{sub(/.*hwhandler=1 /, ""); sub(/\]$/, ""); print}')
@@ -570,7 +572,7 @@ find_modules_dmraid() {
 	local dev phydevs=$(dmraid -r -cdevpath,raidname | awk -F, -vv="$raidname" '{if ($2 == v) print $1}')
 	for dev in $phydevs; do
 		find_modules_for_device $dev
-		dmraid_devices="$dmraid_devices $dev"
+		lvm_ignore_devices="$lvm_ignore_devices $dev"
 		found=1
 	done
 
@@ -1334,8 +1336,6 @@ EOF
 		[ $a = /dev/mapper/control ] && continue
 		kpartx -a $a
 	done
-	rm -f /dev/sd?* # XXX adjust lvm.conf instead. however at initrd creation time
-	sh
 
 	umount /sys
 	umount /proc
@@ -1344,7 +1344,7 @@ EOF
 
 initrd_gen_dmraid() {
 	if [ ! -x /sbin/dmraid-initrd ] ; then
-		die "/sbin/dmraid-initrd is missing missing!"
+		die "/sbin/dmraid-initrd is missing!"
 	fi
 
 	# always make /dev on tmpfs
@@ -1527,15 +1527,17 @@ initrd_gen_lvm() {
 		if is_yes "$have_dmraid" || is_yes "$have_multipath"; then
 			echo '	types = [ "device-mapper", 254 ]' >> "$MNTIMAGE/etc/lvm.conf"
 		fi
-		if [ "$dmraid_devices" ]; then
-			# ignore /dev/sd* devices that dmraid consists
+		if [ "$lvm_ignore_devices" ]; then
+			# TODO: think of merging with lvm dumpconfig output
 			echo '	filter = [' >> "$MNTIMAGE/etc/lvm.conf"
-			for dev in $dmraid_devices; do
-				debug "dmraid: ignoring $dev from LVM"
+			local dev
+			for dev in $lvm_ignore_devices; do
+				debug "LVM2: ignore device $dev"
 				printf '  "r|^%s.*|",\n' $dev
 			done >> "$MNTIMAGE/etc/lvm.conf"
 			echo ']' >> "$MNTIMAGE/etc/lvm.conf"
 		fi
+		# XXX filter= must be on one line!
 		lvm dumpconfig | awk '/filter=/' >> "$MNTIMAGE/etc/lvm.conf"
 		echo "}" >> "$MNTIMAGE/etc/lvm.conf"
 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/readonly/geninitrd.git/commitdiff/147754ca159d40ca5eb541074dc043d8cbd92090



More information about the pld-cvs-commit mailing list