[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#440439: add multipath support



Package: hw-detect
Version: 1.54
Severity: wishlist
Tags: patch

Hi,
the attached patch adds detection of I/O multipaths to disk-detect. This
has to be enabled by using disk-detect/multipath/enable=true and is
modeled after the dmraid code. If multipaths are found it pulls in the
partman-multipath udeb so the paths can be properly partitioned.
Please apply,
 -- Guido
diff --git a/debian/disk-detect.templates b/debian/disk-detect.templates
index 745b0f3..0698e40 100644
--- a/debian/disk-detect.templates
+++ b/debian/disk-detect.templates
@@ -30,3 +30,10 @@ Type: boolean
 Default: false
 Description: for internal use; can be preseeded
  Check for the presence of Serial ATA RAID (dmraid) disks?
+
+Template: disk-detect/multipath/enable
+Type: boolean
+Default: false
+Description: for internal use; can be preseeded
+ Check for the presence of multipathed devices?
+
diff --git a/disk-detect.sh b/disk-detect.sh
old mode 100755
new mode 100644
index bee2d2d..6c84088
--- a/disk-detect.sh
+++ b/disk-detect.sh
@@ -91,6 +91,20 @@ module_probe() {
 	fi
 }
 
+multipath_probe() {
+    MP_VERBOSE=3
+    # Look for multipaths...
+    if [ ! -f /etc/multipath.conf ]; then
+cat <<EOF >/etc/multipath.conf
+defaults {
+    user_friendly_names yes
+}
+EOF
+    fi
+    log-output -t disk-detect /sbin/multipath -v$MP_VERBOSE
+    [ -n "$(/sbin/multipath -l)" -a $? ] && return 0 || return 1
+}
+
 hw-detect disk-detect/detect_progress_title || true
 
 while ! disk_found; do
@@ -171,3 +185,29 @@ if [ "$RET" = true ]; then
 		fi
 	fi
 fi
+
+# Activate support for DM Multipath
+db_get disk-detect/multipath/enable
+if [ "$RET" = true ]; then
+	if anna-install multipath-udeb; then
+		MODULES="dm-mod dm-multipath dm-round-robin dm-emc"
+		# We need some dm modules...
+		for MODULE in $MODULES; do
+			if is_not_loaded $MODULE; then
+				module_probe $MODULE || true
+			fi
+		done
+
+		# Look for multipaths...
+		if multipath_probe; then
+			logger -t disk-detect "Multipath devices found; enabling multipath support"
+			if ! anna-install partman-multipath; then
+				/sbin/multipath -F
+				logger -t disk-detect "Error loading partman-multipath; multipath devices deactivated"
+			fi
+		else
+			logger -t disk-detect "No multipath devices detected"
+		fi
+	fi
+fi
+

Reply to: