SVN: geninitrd/trunk/geninitrd

glen glen at pld-linux.org
Wed Oct 24 19:58:10 CEST 2007


Author: glen
Date: Wed Oct 24 19:58:10 2007
New Revision: 8854

Modified:
   geninitrd/trunk/geninitrd
Log:
- detect physical devices for dm-multipath

Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd	(original)
+++ geninitrd/trunk/geninitrd	Wed Oct 24 19:58:10 2007
@@ -548,21 +548,31 @@
 	fi
 
 	if [[ "$devpath" == /dev/mapper/* ]] && is_yes "$USE_MULTIPATH"; then
-		# remove partition info
+		# remove partition
 		local disk=${devpath%p[0-9]*}
-		local info=$(dmsetup table $disk)
-		debug "dmsetup table: $info"
+		local id=${disk#/dev/mapper/}
 
-		if [[ "$info" == *multipath* ]]; then
+		local info=$(multipath -l $id)
+		if [ "$info" ]; then
+			debug "have multipath"
 			use_multipath=yes
-			findmodule "dm-mod"
-			findmodule "dm-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
+			done
+
+			local hw hwhandlers=$(echo "$info" | awk '/hwhandler=1/{sub(/.*hwhandler=1 /, ""); sub(/\]$/, ""); print}')
+			for hw in $hwhandlers; do
+				findmodule "dm-$hw"
+			done
 
-			[[ "$info" == *round-robin* ]] && findmodule "dm-round-robin"
-			[[ "$info" == *emc* ]] && findmodule "dm-emc"
+			local target targets=$(echo "$info" | awk '/prio=/{print $2}' | sort -u)
+			for target in $targets; do
+				findmodule "dm-$target"
+			done
+
+			findmodule "dm-mod"
 			return
-			# TODO
-			# fallback to multipath containers
 		fi
 
 		# fallback
@@ -1267,10 +1277,10 @@
 	fi
 	inst_d $lib
 	inst /lib64/ld-linux-x86-64.so.2 $lib
-	for a in $(ldd /sbin/kpartx /sbin/multipath | awk '{print $3}'); do
+	for a in $(ldd /sbin/kpartx /sbin/multipath | grep -v linux-gate.so | sort -u | awk '{print $3}'); do
 	   	inst $a $lib
 	done
-	for a in $(ldd $MNTIMAGE$lib/lib* | awk '{print $3}'); do
+	for a in $(ldd $MNTIMAGE$lib/lib* | grep -v linux-gate.so | sort -u | awk '{print $3}'); do
 	   	inst $a $lib
 	done
 


More information about the pld-cvs-commit mailing list