Skip to contentSkip to conversation

Add support for bringing up multipath root devices

PATCH In review Peter Jones 2 participants 21 messages Nov 24, 2009 – Nov 25, 2009 17 messages not in the archive

lore
Share & tools
lore
#0 lore raw

This patch series adds support for bringing up the root device when it's on a multipath device. It suplements the current multipath support which is provided by device-mapper-multipath by adding logic to scan for multipaths as configured in multipath.conf .

A message that is not in the archive (sent off-list or not yet received): 1259092378-14143-1-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

#2 lore raw

PATCH 1/4 Use glob for libdir when installing multipath libraries.

Use "/lib*/" not "/lib/" so it works when they're in /lib/multipath as well as when they're in /lib64/multipath

---
 modules.d/90multipath/install |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
modules.d/90multipath/install +3 -2
index 9552918..d20ea38 100755
@@ -11,8 +11,9 @@ for f in  \
     /sbin/xdrgetuid \
     /sbin/xdrgetprio \
     /etc/xdrdevices.conf \
-    /lib/libmultipath*  \
-    /lib/multipath/* ;do 
+    /lib*/libmultipath* \
+    /lib*/multipath/*
+    	;do
     inst $f
 done
 
Signature · 1 line
1.6.5.2

A message that is not in the archive (sent off-list or not yet received): 1259092378-14143-2-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

#4 lore raw

Re: [PATCH 1/4] Use glob for libdir when installing multipath libraries.

Quoted 11 lines · Peter Jones

Use "/lib*/" not "/lib/" so it works when they're in /lib/multipath as well as when they're in /lib64/multipath

---
 modules.d/90multipath/install |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
modules.d/90multipath/install +0 -0
index 9552918..d20ea38 100755

modules.d/90multipath/install for f in \ · line 18

Quoted 10 lines
modules.d/90multipath/install +3 -2
@@ -11,8 +11,9 @@ for f in  \
     /sbin/xdrgetuid \
     /sbin/xdrgetprio \
     /etc/xdrdevices.conf \
-    /lib/libmultipath*  \
-    /lib/multipath/* ;do 
+    /lib*/libmultipath* \
+    /lib*/multipath/*
+    	;do
     inst $f
 done

It occurs to me that I missed a "\" here when I inserted a newline.

Signature · 3 lines
        Peter

Any connection between your reality and mine is purely coincidental.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

PATCH 1/4 Use glob for libdir when installing multipath libraries.

Use "/lib*/" not "/lib/" so it works when they're in /lib/multipath as well as when they're in /lib64/multipath

---
 modules.d/90multipath/install |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
modules.d/90multipath/install +3 -2
index 9552918..7bdf686 100755
@@ -11,8 +11,9 @@ for f in  \
     /sbin/xdrgetuid \
     /sbin/xdrgetprio \
     /etc/xdrdevices.conf \
-    /lib/libmultipath*  \
-    /lib/multipath/* ;do 
+    /lib*/libmultipath* \
+    /lib*/multipath/* \
+    	;do
     inst $f
 done
 
Signature · 1 line
1.6.5.2
#7 lore raw

PATCH 2/4 Add #!/bin/bash for consistency.

In reply to a message not in the archive

Most install scripts seem to have it there, may as well make this one like the rest...

---
 modules.d/90multipath/install |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
modules.d/90multipath/install +2 -0
index d20ea38..52d69f5 100755
@@ -1,3 +1,5 @@
+#!/bin/bash
+
 if [[ $hostonly ]]; then
     inst /etc/multipath.conf
 fi
Signature · 1 line
1.6.5.2
#8 lore raw

PATCH 3/4 Make sure and get all the multipath related modules.

In reply to a message not in the archive

Install all modules that are any of:
- scsi device handler
- dm log handler
- dm path selector
- dm target

It would be nice if we could tell which log handlers and targets are multipath related, but we really can't.

---
 modules.d/90multipath/installkernel |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
modules.d/90multipath/installkernel +8 -1
index 50c7d6a..4a596f0 100755
@@ -1 +1,8 @@
-instmods dm-multipath dm-round-robin multipath
+#!/bin/bash
+
+mp_mod_test() {
+    local mpfuncs='scsi_register_device_handler|dm_dirty_log_type_register|dm_register_path_selector|dm_register_target'
+    nm -uPA "$1" | egrep -q "$mpfuncs"
+}
+
+instmods $(filter_kernel_modules mp_mod_test)
Signature · 1 line
1.6.5.2
#9 lore raw

PATCH 4/4 Bring up multipath devices that are configured in multipath.conf.

In reply to a message not in the archive

This brings up multipath devices which are configured in multipath.conf as we find them.

---
 modules.d/90multipath/14-multipath-scan.rules |    9 +++++++++
 modules.d/90multipath/install                 |    3 +++
 modules.d/90multipath/multipath-scan.sh       |   16 ++++++++++++++++
 3 files changed, 28 insertions(+), 0 deletions(-)
 create mode 100644 modules.d/90multipath/14-multipath-scan.rules
 create mode 100644 modules.d/90multipath/multipath-scan.sh
modules.d/90multipath/14-multipath-scan.rules new file +9 -0
new file mode 100644
index 0000000..fcb8173
@@ -0,0 +1,9 @@
+# scan for multipath devices
+SUBSYSTEM!="block", GOTO="end_mpath_scan"
+KERNEL!="sd*", GOTO="end_mpath_scan"
+PROGRAM=="/bin/sh -c 'for i in //holders/dm-[0-9]*; do [ -e 9429i ] && exit 0; done; exit 1;' ", GOTO="end_mpath_scan"
+RUN+="/sbin/modprobe dm-multipath"
+RUN+="/bin/echo 'queuing multipath scan'"
+RUN+="/sbin/initqueue --settled --onetime --unique --name=mpscan /sbin/multipath-scan"
+RUN+="/bin/sh -c '>/tmp/.multipath-scan-%k;'"
+LABEL="end_mpath_scan"
modules.d/90multipath/install +3 -0
index 52d69f5..9662848 100755
@@ -22,3 +22,6 @@ done
 inst_hook pre-trigger 02 "$moddir/multipathd.sh"
 inst_hook pre-pivot   02 "$moddir/multipathd-stop.sh"
 inst_rules 40-multipath.rules
+
+inst "$moddir/multipath-scan.sh" /sbin/multipath-scan
+inst_rules "$moddir/14-multipath-scan.rules"
modules.d/90multipath/multipath-scan.sh new file +16 -0
new file mode 100644
index 0000000..0e1d3f2
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+# scan for multipaths if udev has settled
+
+. /lib/dracut-lib.sh
+
+[ -d /etc/multipath ] || mkdir -p /etc/multipath
+mpdevs=$(
+    for f in /tmp/.multipath-scan-* ; do
+        [ -e "$f" ] || continue
+        echo -n "${f##/tmp/.multipath-scan-} "
+    done
+)
+
+[ -e /etc/multipath.conf ] || exit 1
+multipath ${mpdevs}
Signature · 1 line
1.6.5.2

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#12 lore raw

Re: [PATCH 1/4] Use glob for libdir when installing multipath libraries.

Hi,

Quoted 12 lines · Peter Jones

Use "/lib*/" not "/lib/" so it works when they're in /lib/multipath as well as when they're in /lib64/multipath

---
  modules.d/90multipath/install |    5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)
modules.d/90multipath/install +0 -0
index 9552918..d20ea38 100755
@@ -11,8 +11,9 @@ for f in  \
      /sbin/xdrgetuid \

modules.d/90multipath/install for f in \ · line 19

Quoted 10 lines
modules.d/90multipath/install +3 -2
      /sbin/xdrgetprio \
      /etc/xdrdevices.conf \
-    /lib/libmultipath*  \
-    /lib/multipath/* ;do
+    /lib*/libmultipath* \
+    /lib*/multipath/*
+    	;do
      inst $f
  done
 

Not sure if we want to handle this this way, this way if both a 32 bit and 64 bit version are present on a system both will get copied to the initrd, I think it would be better to handle this how it is handled in for example:
modules/01fips/install
or
modules/95nfs/install:

if ldd $(which rpc.idmapd) |grep -q lib64; then

    LIBDIR="/lib64"
else
    LIBDIR="/lib"

fi

dracut_install $(ls {/usr,}$LIBDIR/libnfsidmap_nsswitch.so* 2>/dev/null )

Regards,

Hans

A message that is not in the archive (sent off-list or not yet received): [email protected]

#14 lore raw

Re: [PATCH 1/4] Use glob for libdir when installing multipath libraries.

Quoted 35 lines · Hans de Goede

Hi,

Quoted 13 lines · Peter Jones

Use "/lib*/" not "/lib/" so it works when they're in /lib/multipath as well as when they're in /lib64/multipath

---
  modules.d/90multipath/install |    5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)
modules.d/90multipath/install +0 -0
index 9552918..d20ea38 100755
@@ -11,8 +11,9 @@ for f in  \
      /sbin/xdrgetuid \

modules.d/90multipath/install for f in \ · line 19

Quoted 10 lines
modules.d/90multipath/install +3 -2
      /sbin/xdrgetprio \
      /etc/xdrdevices.conf \
-    /lib/libmultipath*  \
-    /lib/multipath/* ;do
+    /lib*/libmultipath* \
+    /lib*/multipath/*
+        ;do
      inst $f
  done
 

Not sure if we want to handle this this way, this way if both a 32 bit and 64 bit version are present on a system both will get copied to the initrd, I think it would be better to handle this how it is handled in for example:
modules/01fips/install
or
modules/95nfs/install:

Quoted 7 lines

if ldd $(which rpc.idmapd) |grep -q lib64; then

    LIBDIR="/lib64"
else
    LIBDIR="/lib"

fi

dracut_install $(ls {/usr,}$LIBDIR/libnfsidmap_nsswitch.so* 2>/dev/null )

Fair point. I'm really not sure why device-mapper-multipath is a multilib package at all, but I guess it's best to do what you're saying.

Signature · 4 lines
        Peter

"I can imagine a world without war, without hate. I can imagine us
attacking it, because they'd never expect it."

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#17 lore raw

Re: [PATCH 2/4] Add #!/bin/bash for consistency.

Hi,

Quoted 11 lines · Peter Jones

Most install scripts seem to have it there, may as well make this one like the rest...

---
  modules.d/90multipath/install |    2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
modules.d/90multipath/install +0 -0
index d20ea38..52d69f5 100755

modules.d/90multipath/install line 5

Quoted 5 lines
modules.d/90multipath/install +2 -0
@@ -1,3 +1,5 @@
+#!/bin/bash
+
  if [[ $hostonly ]]; then
      inst /etc/multipath.conf
  fi

Ack,

Regards,

hans

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#20 lore raw

Re: [PATCH 3/4] Make sure and get all the multipath related modules.

Hi,

Quoted 17 lines · Peter Jones

Install all modules that are any of:
- scsi device handler
- dm log handler
- dm path selector
- dm target

It would be nice if we could tell which log handlers and targets are multipath related, but we really can't.

---
  modules.d/90multipath/installkernel |    9 ++++++++-
  1 files changed, 8 insertions(+), 1 deletions(-)
modules.d/90multipath/installkernel +0 -0
index 50c7d6a..4a596f0 100755

modules.d/90multipath/installkernel line 8

Quoted 9 lines
modules.d/90multipath/installkernel +8 -1
@@ -1 +1,8 @@
-instmods dm-multipath dm-round-robin multipath
+#!/bin/bash
+
+mp_mod_test() {
+    local mpfuncs='scsi_register_device_handler|dm_dirty_log_type_register|dm_register_path_selector|dm_register_target'
+    nm -uPA "$1" | egrep -q "$mpfuncs"
+}
+
+instmods $(filter_kernel_modules mp_mod_test)

Looks good to me, ack.

Regards,

Hans

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#23 lore raw

Re: [PATCH 4/4] Bring up multipath devices that are configured in multipath.conf.

Hi,

Quoted 16 lines · Peter Jones

This brings up multipath devices which are configured in multipath.conf as we find them.

---
  modules.d/90multipath/14-multipath-scan.rules |    9 +++++++++
  modules.d/90multipath/install                 |    3 +++
  modules.d/90multipath/multipath-scan.sh       |   16 ++++++++++++++++
  3 files changed, 28 insertions(+), 0 deletions(-)

create mode 100644 modules.d/90multipath/14-multipath-scan.rules create mode 100644 modules.d/90multipath/multipath-scan.sh

modules.d/90multipath/14-multipath-scan.rules new file +0 -0
new file mode 100644
index 0000000..fcb8173

modules.d/90multipath/14-multipath-scan.rules line 4

Quoted 4 lines
modules.d/90multipath/14-multipath-scan.rules new file +4 -0
@@ -0,0 +1,9 @@
+# scan for multipath devices
+SUBSYSTEM!="block", GOTO="end_mpath_scan"
+KERNEL!="sd*", GOTO="end_mpath_scan"
+PROGRAM=="/bin/sh -c 'for i in //holders/dm-[0-9]*; do [ -e 9429i ]&&  exit 0; done; exit 1;' ", GOTO="end_mpath_scan"

What is this 9429i thingie ? a comment about this in the rules file might be good to have.

Quoted 28 lines
modules.d/90multipath/14-multipath-scan.rules new file +5 -0
+RUN+="/sbin/modprobe dm-multipath"
+RUN+="/bin/echo 'queuing multipath scan'"
+RUN+="/sbin/initqueue --settled --onetime --unique --name=mpscan /sbin/multipath-scan"
+RUN+="/bin/sh -c '>/tmp/.multipath-scan-%k;'"
+LABEL="end_mpath_scan"
modules.d/90multipath/install +3 -0
index 52d69f5..9662848 100755
@@ -22,3 +22,6 @@ done
  inst_hook pre-trigger 02 "$moddir/multipathd.sh"
  inst_hook pre-pivot   02 "$moddir/multipathd-stop.sh"
  inst_rules 40-multipath.rules
+
+inst "$moddir/multipath-scan.sh" /sbin/multipath-scan
+inst_rules "$moddir/14-multipath-scan.rules"
modules.d/90multipath/multipath-scan.sh new file +6 -0
new file mode 100644
index 0000000..0e1d3f2
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+# scan for multipaths if udev has settled
+
+. /lib/dracut-lib.sh
+

modules.d/90multipath/multipath-scan.sh line 16

Quoted 10 lines
modules.d/90multipath/multipath-scan.sh new file +10 -0
+[ -d /etc/multipath ] || mkdir -p /etc/multipath
+mpdevs=$(
+    for f in /tmp/.multipath-scan-* ; do
+        [ -e "$f" ] || continue
+        echo -n "${f##/tmp/.multipath-scan-} "
+    done
+)
+
+[ -e /etc/multipath.conf ] || exit 1
+multipath ${mpdevs}

command / where does it come from ?

Other then that I wonder what the 9429i thingie is, it looks good.

Regards,

Hans

A message that is not in the archive (sent off-list or not yet received): [email protected]

#25 lore raw

Re: [PATCH 4/4] Bring up multipath devices that are configured in multipath.conf.

Quoted 13 lines · Hans de Goede

Hi,

Quoted 10 lines · Peter Jones

This brings up multipath devices which are configured in multipath.conf as we find them.

---
  modules.d/90multipath/14-multipath-scan.rules |    9 +++++++++
  modules.d/90multipath/install                 |    3 +++
  modules.d/90multipath/multipath-scan.sh       |   16 ++++++++++++++++
  3 files changed, 28 insertions(+), 0 deletions(-)

create mode 100644 modules.d/90multipath/14-multipath-scan.rules create mode 100644 modules.d/90multipath/multipath-scan.sh

Quoted 15 lines
Quoted 11 lines
modules.d/90multipath/14-multipath-scan.rules new file +4 -0
new file mode 100644
index 0000000..fcb8173
@@ -0,0 +1,9 @@
+# scan for multipath devices
+SUBSYSTEM!="block", GOTO="end_mpath_scan"
+KERNEL!="sd*", GOTO="end_mpath_scan"
+PROGRAM=="/bin/sh -c 'for i in //holders/dm-[0-9]*; do [ -e 9429i
Quoted 1 line

]&& exit 0; done; exit 1;' ", GOTO="end_mpath_scan"

What is this 9429i thingie ? a comment about this in the rules file might be good to have.

Something really funny happened and I'm not sure how or at what step. It's supposed to be "$$i". I'll post a corrected version with your other suggestions.

Signature · 4 lines
        Peter

"I can imagine a world without war, without hate. I can imagine us
attacking it, because they'd never expect it."

A message that is not in the archive (sent off-list or not yet received): [email protected]

#27 lore raw

Add support for bringing up multipath root devices [version 2]

This patch series adds support for bringing up the root device when it's on a multipath device. It suplements the current multipath support which is provided by device-mapper-multipath by adding logic to scan for multipaths as configured in multipath.conf .

This revision includes changes suggested by Hans De Goede.

#28 lore raw

PATCH 1/4 Use glob for libdir when installing multipath libraries.

In reply to a message not in the archive

Use "/lib*/" not "/lib/" so it works when they're in /lib/multipath as well as when they're in /lib64/multipath

---
 modules.d/90multipath/install |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
modules.d/90multipath/install +8 -2
index 9552918..4890825 100755
@@ -2,6 +2,12 @@ if [[ $hostonly ]]; then
     inst /etc/multipath.conf
 fi
 
+if ldd $(/sbin/multipath) |grep -q lib64; then
+    LIBDIR="/lib64"
+else
+    LIBDIR="/lib"
+fi
+
 for f in  \
     /sbin/dmsetup \
     /sbin/kpartx \
@@ -11,8 +17,8 @@ for f in  \
     /sbin/xdrgetuid \
     /sbin/xdrgetprio \
     /etc/xdrdevices.conf \
-    /lib/libmultipath*  \
-    /lib/multipath/* ;do 
+    $(ls $LIBDIR/libmultipath* $LIBDIR/multipath/*) \
+    	;do
     inst $f
 done
 
Signature · 1 line
1.6.5.2

A message that is not in the archive (sent off-list or not yet received): 1259162752-22372-2-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

#30 lore raw

Re: [PATCH 1/4] Use glob for libdir when installing multipath libraries.

Quoted 11 lines · Peter Jones

Use "/lib*/" not "/lib/" so it works when they're in /lib/multipath as well as when they're in /lib64/multipath

---
 modules.d/90multipath/install |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
modules.d/90multipath/install +0 -0
index 9552918..4890825 100755

modules.d/90multipath/install if [[ $hostonly ]]; then · line 5

Quoted 4 lines
modules.d/90multipath/install +1 -0
@@ -2,6 +2,12 @@ if [[ $hostonly ]]; then
     inst /etc/multipath.conf
 fi
 
+if ldd $(/sbin/multipath) |grep -q lib64; then

This is obviously wrong.

Quoted 19 lines
modules.d/90multipath/install +7 -2
+    LIBDIR="/lib64"
+else
+    LIBDIR="/lib"
+fi
+
 for f in  \
     /sbin/dmsetup \
     /sbin/kpartx \
@@ -11,8 +17,8 @@ for f in  \
     /sbin/xdrgetuid \
     /sbin/xdrgetprio \
     /etc/xdrdevices.conf \
-    /lib/libmultipath*  \
-    /lib/multipath/* ;do 
+    $(ls $LIBDIR/libmultipath* $LIBDIR/multipath/*) \
+    	;do
     inst $f
 done
 
Signature · 4 lines
        Peter

"I can imagine a world without war, without hate. I can imagine us
attacking it, because they'd never expect it."
#31 lore raw

PATCH 2/4 Add #!/bin/bash for consistency.

In reply to a message not in the archive

Most install scripts seem to have it there, may as well make this one like the rest...

---
 modules.d/90multipath/install |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
modules.d/90multipath/install +2 -0
index 4890825..499f7c9 100755
@@ -1,3 +1,5 @@
+#!/bin/bash
+
 if [[ $hostonly ]]; then
     inst /etc/multipath.conf
 fi
Signature · 1 line
1.6.5.2
#32 lore raw

PATCH 3/4 Make sure and get all the multipath related modules.

In reply to a message not in the archive

Install all modules that are any of:
- scsi device handler
- dm log handler
- dm path selector
- dm target

It would be nice if we could tell which log handlers and targets are multipath related, but we really can't.

---
 modules.d/90multipath/installkernel |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
modules.d/90multipath/installkernel +8 -1
index 50c7d6a..4a596f0 100755
@@ -1 +1,8 @@
-instmods dm-multipath dm-round-robin multipath
+#!/bin/bash
+
+mp_mod_test() {
+    local mpfuncs='scsi_register_device_handler|dm_dirty_log_type_register|dm_register_path_selector|dm_register_target'
+    nm -uPA "$1" | egrep -q "$mpfuncs"
+}
+
+instmods $(filter_kernel_modules mp_mod_test)
Signature · 1 line
1.6.5.2
#33 lore raw

PATCH 4/4 Bring up multipath devices that are configured in multipath.conf.

In reply to a message not in the archive

This brings up multipath devices which are configured in multipath.conf as we find them.

---
 modules.d/90multipath/14-multipath-scan.rules |    9 +++++++++
 modules.d/90multipath/install                 |    3 +++
 modules.d/90multipath/multipath-scan.sh       |   16 ++++++++++++++++
 3 files changed, 28 insertions(+), 0 deletions(-)
 create mode 100644 modules.d/90multipath/14-multipath-scan.rules
 create mode 100644 modules.d/90multipath/multipath-scan.sh
modules.d/90multipath/14-multipath-scan.rules new file +9 -0
new file mode 100644
index 0000000..b4acf57
@@ -0,0 +1,9 @@
+# scan for multipath devices
+SUBSYSTEM!="block", GOTO="end_mpath_scan"
+KERNEL!="sd*", GOTO="end_mpath_scan"
+PROGRAM=="/bin/sh -c 'for i in //holders/dm-[0-9]*; do [ -e $$i ] && exit 0; done; exit 1;' ", GOTO="end_mpath_scan"
+RUN+="/sbin/modprobe dm-multipath"
+RUN+="/bin/echo 'queuing multipath scan'"
+RUN+="/sbin/initqueue --settled --onetime --unique --name=mpscan /sbin/multipath-scan"
+RUN+="/bin/sh -c '>/tmp/.multipath-scan-%k;'"
+LABEL="end_mpath_scan"
modules.d/90multipath/install +3 -0
index 499f7c9..bafdd2c 100755
@@ -27,3 +27,6 @@ done
 inst_hook pre-trigger 02 "$moddir/multipathd.sh"
 inst_hook pre-pivot   02 "$moddir/multipathd-stop.sh"
 inst_rules 40-multipath.rules
+
+inst "$moddir/multipath-scan.sh" /sbin/multipath-scan
+inst_rules "$moddir/14-multipath-scan.rules"
modules.d/90multipath/multipath-scan.sh new file +16 -0
new file mode 100644
index 0000000..0e1d3f2
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+# scan for multipaths if udev has settled
+
+. /lib/dracut-lib.sh
+
+[ -d /etc/multipath ] || mkdir -p /etc/multipath
+mpdevs=$(
+    for f in /tmp/.multipath-scan-* ; do
+        [ -e "$f" ] || continue
+        echo -n "${f##/tmp/.multipath-scan-} "
+    done
+)
+
+[ -e /etc/multipath.conf ] || exit 1
+multipath ${mpdevs}
Signature · 1 line
1.6.5.2

A message that is not in the archive (sent off-list or not yet received): 1259162752-22372-5-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

#35 lore raw

Re: [PATCH 4/4] Bring up multipath devices that are configured in multipath.conf.

Hi,

Patch 1-3 look good.

Quoted 16 lines · Peter Jones

This brings up multipath devices which are configured in multipath.conf as we find them.

---
  modules.d/90multipath/14-multipath-scan.rules |    9 +++++++++
  modules.d/90multipath/install                 |    3 +++
  modules.d/90multipath/multipath-scan.sh       |   16 ++++++++++++++++
  3 files changed, 28 insertions(+), 0 deletions(-)

create mode 100644 modules.d/90multipath/14-multipath-scan.rules create mode 100644 modules.d/90multipath/multipath-scan.sh

modules.d/90multipath/14-multipath-scan.rules new file +0 -0
new file mode 100644
index 0000000..b4acf57

modules.d/90multipath/14-multipath-scan.rules line 9

Quoted 9 lines
modules.d/90multipath/14-multipath-scan.rules new file +9 -0
@@ -0,0 +1,9 @@
+# scan for multipath devices
+SUBSYSTEM!="block", GOTO="end_mpath_scan"
+KERNEL!="sd*", GOTO="end_mpath_scan"
+PROGRAM=="/bin/sh -c 'for i in //holders/dm-[0-9]*; do [ -e $$i ]&&  exit 0; done; exit 1;' ", GOTO="end_mpath_scan"
+RUN+="/sbin/modprobe dm-multipath"
+RUN+="/bin/echo 'queuing multipath scan'"
+RUN+="/sbin/initqueue --settled --onetime --unique --name=mpscan /sbin/multipath-scan"
+RUN+="/bin/sh -c '>/tmp/.multipath-scan-%k;'"
+LABEL="end_mpath_scan"

Hmm, I just realized something, this rule will keep on triggering if a disk is not part of a multipath setup. As in that case it will never become a holder of a device mapper device.

And since things like opening /dev/sda rw (which /sbin/multipath might very well do), trigger a change event, this feels like an infinite loop to me.

Maybe this rule should have a
ACTION!="add", GOTO="end_mpath_scan"

?

I think it would be best to discuss this with Harald.

Regards,

Hans

A message that is not in the archive (sent off-list or not yet received): [email protected]

#37 lore raw

Re: [PATCH 4/4] Bring up multipath devices that are configured in multipath.conf.

Quoted 40 lines · Hans de Goede

Hi,

Patch 1-3 look good.

Quoted 26 lines · Peter Jones

This brings up multipath devices which are configured in multipath.conf as we find them.

---
  modules.d/90multipath/14-multipath-scan.rules |    9 +++++++++
  modules.d/90multipath/install                 |    3 +++
  modules.d/90multipath/multipath-scan.sh       |   16 ++++++++++++++++
  3 files changed, 28 insertions(+), 0 deletions(-)

create mode 100644 modules.d/90multipath/14-multipath-scan.rules create mode 100644 modules.d/90multipath/multipath-scan.sh

modules.d/90multipath/14-multipath-scan.rules new file +4 -0
new file mode 100644
index 0000000..b4acf57
@@ -0,0 +1,9 @@
+# scan for multipath devices
+SUBSYSTEM!="block", GOTO="end_mpath_scan"
+KERNEL!="sd*", GOTO="end_mpath_scan"
+PROGRAM=="/bin/sh -c 'for i in //holders/dm-[0-9]*; do [ -e $$i ]&& 

exit 0; done; exit 1;' ", GOTO="end_mpath_scan"

modules.d/90multipath/14-multipath-scan.rules new file +3 -0
+RUN+="/sbin/modprobe dm-multipath"
+RUN+="/bin/echo 'queuing multipath scan'"
+RUN+="/sbin/initqueue --settled --onetime --unique --name=mpscan

/sbin/multipath-scan"

modules.d/90multipath/14-multipath-scan.rules line 9

Quoted 2 lines
modules.d/90multipath/14-multipath-scan.rules new file +2 -0
+RUN+="/bin/sh -c '>/tmp/.multipath-scan-%k;'"
+LABEL="end_mpath_scan"

Hmm, I just realized something, this rule will keep on triggering if a disk is
not part of a multipath setup. As in that case it will never become a holder
of a device mapper device.

Quoted 3 lines

And since things like opening /dev/sda rw (which /sbin/multipath might very well do), trigger a change event, this feels like an infinite loop to me.

It does not trigger a change event.

Quoted 10 lines

Maybe this rule should have a
ACTION!="add", GOTO="end_mpath_scan"

?

I think it would be best to discuss this with Harald.

Regards,

Hans

Signature · 4 lines
        Peter

"I can imagine a world without war, without hate. I can imagine us
attacking it, because they'd never expect it."