diff mbox

multipath-tools/multipath kpartx_get_name mpat ...

Message ID 20100525225148.27224.qmail@sourceware.org (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

bmarzins@sourceware.org May 25, 2010, 10:51 p.m. UTC
None
diff mbox

Patch

--- multipath-tools/multipath/Attic/kpartx_get_name	2006/05/12 22:17:13	1.1
+++ multipath-tools/multipath/Attic/kpartx_get_name	2010/05/25 22:51:42	1.1.2.1
@@ -25,7 +25,8 @@ 
 	exit 1
 fi
 
-i=`/sbin/dmsetup ls --target linear --exec basename -j $1 -m $2 2> /dev/null`
+dev=`/sbin/dmsetup ls --target linear -j $1 -m $2 | sed -e 's/([ 0-9]*,[ 0-9]*)//g' 2>/dev/null`
+i=`basename $dev 2>/dev/null`
 
 if [ -n "$i" ] ; then
 	echo $i
--- multipath-tools/multipath/Attic/mpath_get_name	2006/05/12 22:17:13	1.1
+++ multipath-tools/multipath/Attic/mpath_get_name	2010/05/25 22:51:42	1.1.2.1
@@ -19,7 +19,8 @@ 
 	exit 1
 fi
 
-i=`/sbin/dmsetup ls --target multipath --exec basename -j $1 -m $2 2> /dev/null`
+dev=`/sbin/dmsetup ls --target multipath -j $1 -m $2 | sed -e 's/([ 0-9]*,[ 0-9]*)//g' 2>/dev/null`
+i=`basename $dev 2>/dev/null`
 
 if [ -n "$i" ] ; then
 	echo $i
--- multipath-tools/multipath/Attic/multipath.dev	2006/06/28 19:29:10	1.13.2.1
+++ multipath-tools/multipath/Attic/multipath.dev	2010/05/25 22:51:42	1.13.2.2
@@ -29,5 +29,8 @@ 
 
 if [ "${DEVPATH:7:3}" = "dm-" -a "${ACTION}" = "add" ]; then
 	majmin=`awk -F ':' '{ print "-j",$1,"-m",$2 }' /sys/${DEVPATH}/dev`
-	/sbin/dmsetup ls ${majmin} --target multipath --exec "/sbin/kpartx -a"
+	devnames=`/sbin/dmsetup ls ${majmin} --target multipath | sed -e 's/([ 0-9]*,[ 0-9]*)//g'`
+	for dev in $devnames; do
+		[ -n "$dev" ] && /sbin/kpartx -a /dev/mapper/$dev
+	done
 fi