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

Bug#806900: partman-multipath: correct mpath device detection and bindings



Package: partman-multipath
Version: 4
Severity: important
Tags: d-i patch

Dear Maintainers,

the partman-multipath installer modules does not detect multipath devices
because the multipath alias names have been changed.  Also the location of
the bindings file has been changed and, therefore, correct its location in
the post-base-installer script.

Below you can find a patch that solves both problems.  Feedback is welcome.

Thanks!

Kind regards,
  Hendrik
>From d4c73caff072a79bd6e4428480fc34951ca6d84c Mon Sep 17 00:00:00 2001
From: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Date: Thu, 26 Nov 2015 17:29:11 +0100
Subject: [PATCH 1/2] multipath: update check for mpath device and bindings

The mulitpath-tools use different alias names and store their
bindings in in the /etc/multipath/ directory.  This commit
changes detection of mpath devices and mulitpath configuration
accordingly.

The alias names for user friendly names have been changed from
mpath[0-9] to mpath[a-z] since 2008.  So update all mpath checkings
to use new alias naming scheme.

See also
https://anonscm.debian.org/cgit/pkg-lvm/multipath-tools.git/commit/?id=81716d6fe5ccf220e320e168391817810645c3b4

The location of the bindings file which maps the alias names to
particular wwn's also changed.  The bindings file moved from
the /var/lib/multipath/ directory to the /etc/multipath/ directory.

The bindings file is required to successfully map an multipath alias
always to the same SCSI disk.  Without these bindings, for example,
the device with the root file system might appear as a different mpathX
device after an reboot.

See also
https://anonscm.debian.org/cgit/pkg-lvm/multipath-tools.git/commit/?id=8ee04831d2535a5afcf5dd40a27e2645ec0b7ffa

Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
---
 init.d/multipath_flag             | 2 +-
 post-base-installer.d/60multipath | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/init.d/multipath_flag b/init.d/multipath_flag
index 862765f..fdd32aa 100755
--- a/init.d/multipath_flag
+++ b/init.d/multipath_flag
@@ -7,7 +7,7 @@ for dev in /var/lib/partman/devices/*; do
 	cd $dev
 
 	[ -f device ] || continue
-	for frdisk in $(multipath -l | grep '^mpath[0-9]\+ ' | sed 's/\(mpath[0-9]\+\) .*/\1/'); do
+	for frdisk in $(multipath -l | grep '^mpath[a-z]\+ ' | sed 's/\(mpath[a-z]\+\) .*/\1/'); do
 		case $(cat device) in
 			/dev/mapper/$frdisk)
 				>multipath
diff --git a/post-base-installer.d/60multipath b/post-base-installer.d/60multipath
index cb21b60..35169fe 100755
--- a/post-base-installer.d/60multipath
+++ b/post-base-installer.d/60multipath
@@ -2,7 +2,7 @@
 
 set -e
 
-if [ $(multipath -l | grep '^mpath[0-9]\+' | wc -l) -eq 0 ]; then
+if [ $(multipath -l | grep '^mpath[a-z]\+' | wc -l) -eq 0 ]; then
 	exit 0
 fi
 
@@ -13,9 +13,9 @@ if [ -r /etc/multipath.conf ]; then
 fi
 
 # copy over the persistent binding
-if [ -r /var/lib/multipath/bindings ]; then
-	mkdir -p /target/var/lib/multipath
-	cp /var/lib/multipath/bindings /target/var/lib/multipath/
+if [ -r /etc/multipath/bindings ]; then
+	mkdir -p /target/etc/multipath
+	cp /etc/multipath/bindings /target/etc/multipath
 fi
 
 # the initramfs will be updated by the kernel installation
-- 
2.6.2


Reply to: