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

Bug#440439: Updated patch



Hi,
attached is an updated patch for multipath detection in hw-detect. The
patch hasn't changed it's just rediffed against current SVN.
Cheers,
 -- Guido
>From 96b6e14bf63d4df4ec62d8838ecbdbf2c30a17ba Mon Sep 17 00:00:00 2001
From: Guido Guenther <agx@sigxcpu.org>
Date: Tue, 26 Feb 2008 13:23:38 +0100
Subject: [PATCH] add optional multipath detection to disk-detect.sh

triggered by disk-detect/multipath/enable
---
 packages/hw-detect/debian/disk-detect.templates |    7 ++++
 packages/hw-detect/disk-detect.sh               |   40 +++++++++++++++++++++++
 2 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/packages/hw-detect/debian/disk-detect.templates b/packages/hw-detect/debian/disk-detect.templates
index 974c6b5..6383c60 100644
--- a/packages/hw-detect/debian/disk-detect.templates
+++ b/packages/hw-detect/debian/disk-detect.templates
@@ -35,3 +35,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/packages/hw-detect/disk-detect.sh b/packages/hw-detect/disk-detect.sh
index 325cf4b..67129be 100755
--- a/packages/hw-detect/disk-detect.sh
+++ b/packages/hw-detect/disk-detect.sh
@@ -91,6 +91,20 @@ module_probe() {
 	fi
 }
 
+multipath_probe() {
+    MP_VERBOSE=2
+    # 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
@@ -166,3 +180,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
+
-- 
1.5.4.2


Reply to: