SVN: geninitrd/trunk/mod-multipath.sh
glen
glen at pld-linux.org
Wed Jul 1 14:10:03 CEST 2009
Author: glen
Date: Wed Jul 1 14:10:03 2009
New Revision: 10413
Modified:
geninitrd/trunk/mod-multipath.sh
Log:
- process hwhandler in newer multipath tools manner
Modified: geninitrd/trunk/mod-multipath.sh
==============================================================================
--- geninitrd/trunk/mod-multipath.sh (original)
+++ geninitrd/trunk/mod-multipath.sh Wed Jul 1 14:10:03 2009
@@ -87,11 +87,9 @@
lvm_ignore_devices="$lvm_ignore_devices $p"
done
- # TODO: handle newer multipath-tools:
- # size=7.0G features='0' hwhandler='0' wp=rw
- list=$(echo "$info" | awk '/hwhandler=1/{sub(/.*hwhandler=1 /, ""); sub(/\]$/, ""); print}')
+ list=$(mp_parse_hwhandler "$info")
for p in $list; do
- find_module "dm-$p"
+ find_module "$p"
done
list=$(mp_parse_policy "$info")
@@ -262,3 +260,31 @@
}
' | sort -u
}
+
+# parse hwhandler from multipath output
+# takes 'multipath -l' output as input
+mp_parse_hwhandler() {
+ local info="$1"
+
+ # TODO: actually the dm-emc vs scsi-dh-emc is dependant on kernel version
+ # not version of the tools installed
+
+ # multipath-tools-0.4.8-0.12.amd64
+ # [size=12G][features=1 queue_if_no_path][hwhandler=1 emc]
+ #
+ # multipath-tools-0.4.8-11.x86_64
+ # size=7.0G features='0' hwhandler='0' wp=rw
+ # size=2.0G features='1 queue_if_no_path' hwhandler='1 emc' wp=rw
+ echo "$info" | sed -ne "
+ # multipath-tools-0.4.8-0.12.amd64
+ /\[hwhandler=1/{
+ s,^.*\[hwhandler=1 \([^]]*\)\].*$,dm-\1,
+ p
+ }
+ # multipath-tools-0.4.8-11.x86_64
+ /hwhandler='1/{
+ s,^.*hwhandler='1 \([^']*\)'.*$,scsi-dh-\1,
+ p
+ }
+ " | sort -u
+}
More information about the pld-cvs-commit
mailing list