mkinitrd unification across distributions
 help / color / mirror / Atom feed
* Add support for bringing up multipath root devices
@ 2009-11-24 19:52 Peter Jones
       [not found] ` <1259092378-14143-1-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
                   ` (4 more replies)
  0 siblings, 5 replies; 21+ messages in thread
From: Peter Jones @ 2009-11-24 19:52 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA

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 .

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 1/4] Use glob for libdir when installing multipath libraries.
       [not found] ` <1259092378-14143-1-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-11-24 19:52   ` Peter Jones
       [not found]     ` <1259092378-14143-2-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2009-11-24 19:52   ` [PATCH 2/4] Add #!/bin/bash for consistency Peter Jones
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 21+ messages in thread
From: Peter Jones @ 2009-11-24 19:52 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: 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(-)

diff --git a/modules.d/90multipath/install b/modules.d/90multipath/install
index 9552918..d20ea38 100755
--- a/modules.d/90multipath/install
+++ b/modules.d/90multipath/install
@@ -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
 
-- 
1.6.5.2

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 2/4] Add #!/bin/bash for consistency.
       [not found] ` <1259092378-14143-1-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2009-11-24 19:52   ` [PATCH 1/4] Use glob for libdir when installing multipath libraries Peter Jones
@ 2009-11-24 19:52   ` Peter Jones
  2009-11-24 19:52   ` [PATCH 3/4] Make sure and get all the multipath related modules Peter Jones
  2009-11-24 19:52   ` [PATCH 4/4] Bring up multipath devices that are configured in multipath.conf Peter Jones
  3 siblings, 0 replies; 21+ messages in thread
From: Peter Jones @ 2009-11-24 19:52 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: 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(-)

diff --git a/modules.d/90multipath/install b/modules.d/90multipath/install
index d20ea38..52d69f5 100755
--- a/modules.d/90multipath/install
+++ b/modules.d/90multipath/install
@@ -1,3 +1,5 @@
+#!/bin/bash
+
 if [[ $hostonly ]]; then
     inst /etc/multipath.conf
 fi
-- 
1.6.5.2

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 3/4] Make sure and get all the multipath related modules.
       [not found] ` <1259092378-14143-1-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2009-11-24 19:52   ` [PATCH 1/4] Use glob for libdir when installing multipath libraries Peter Jones
  2009-11-24 19:52   ` [PATCH 2/4] Add #!/bin/bash for consistency Peter Jones
@ 2009-11-24 19:52   ` Peter Jones
  2009-11-24 19:52   ` [PATCH 4/4] Bring up multipath devices that are configured in multipath.conf Peter Jones
  3 siblings, 0 replies; 21+ messages in thread
From: Peter Jones @ 2009-11-24 19:52 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: 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(-)

diff --git a/modules.d/90multipath/installkernel b/modules.d/90multipath/installkernel
index 50c7d6a..4a596f0 100755
--- a/modules.d/90multipath/installkernel
+++ b/modules.d/90multipath/installkernel
@@ -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)
-- 
1.6.5.2

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 4/4] Bring up multipath devices that are configured in multipath.conf.
       [not found] ` <1259092378-14143-1-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
                     ` (2 preceding siblings ...)
  2009-11-24 19:52   ` [PATCH 3/4] Make sure and get all the multipath related modules Peter Jones
@ 2009-11-24 19:52   ` Peter Jones
  3 siblings, 0 replies; 21+ messages in thread
From: Peter Jones @ 2009-11-24 19:52 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: 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

diff --git a/modules.d/90multipath/14-multipath-scan.rules b/modules.d/90multipath/14-multipath-scan.rules
new file mode 100644
index 0000000..fcb8173
--- /dev/null
+++ b/modules.d/90multipath/14-multipath-scan.rules
@@ -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"
diff --git a/modules.d/90multipath/install b/modules.d/90multipath/install
index 52d69f5..9662848 100755
--- a/modules.d/90multipath/install
+++ b/modules.d/90multipath/install
@@ -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"
diff --git a/modules.d/90multipath/multipath-scan.sh b/modules.d/90multipath/multipath-scan.sh
new file mode 100644
index 0000000..0e1d3f2
--- /dev/null
+++ b/modules.d/90multipath/multipath-scan.sh
@@ -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}
-- 
1.6.5.2

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH 1/4] Use glob for libdir when installing multipath libraries.
       [not found]     ` <1259092378-14143-2-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-11-24 19:55       ` Peter Jones
       [not found]         ` <4B0C3A19.3010509-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 21+ messages in thread
From: Peter Jones @ 2009-11-24 19:55 UTC (permalink / raw)
  To: Peter Jones; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA

On 11/24/2009 02:52 PM, Peter Jones wrote:
> 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(-)
> 
> diff --git a/modules.d/90multipath/install b/modules.d/90multipath/install
> index 9552918..d20ea38 100755
> --- a/modules.d/90multipath/install
> +++ b/modules.d/90multipath/install
> @@ -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.

-- 
        Peter

Any connection between your reality and mine is purely coincidental.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 1/4] Use glob for libdir when installing multipath libraries.
       [not found]         ` <4B0C3A19.3010509-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-11-24 19:59           ` Peter Jones
  0 siblings, 0 replies; 21+ messages in thread
From: Peter Jones @ 2009-11-24 19:59 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: 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(-)

diff --git a/modules.d/90multipath/install b/modules.d/90multipath/install
index 9552918..7bdf686 100755
--- a/modules.d/90multipath/install
+++ b/modules.d/90multipath/install
@@ -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
 
-- 
1.6.5.2

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH 1/4] Use glob for libdir when installing multipath libraries.
       [not found]   ` <4B0C40BC.5000107-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-11-25 10:21     ` Hans de Goede
       [not found]       ` <4B0D0531.2050401-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 21+ messages in thread
From: Hans de Goede @ 2009-11-25 10:21 UTC (permalink / raw)
  To: initramfs; +Cc: Peter Jones

Hi,

On 11/24/2009 09:23 PM, Peter Jones wrote:
> 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(-)
>
> diff --git a/modules.d/90multipath/install b/modules.d/90multipath/install
> index 9552918..d20ea38 100755
> --- a/modules.d/90multipath/install
> +++ b/modules.d/90multipath/install
> @@ -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
>

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

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 2/4] Add #!/bin/bash for consistency.
       [not found]   ` <4B0C40E4.6080006-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-11-25 10:22     ` Hans de Goede
  0 siblings, 0 replies; 21+ messages in thread
From: Hans de Goede @ 2009-11-25 10:22 UTC (permalink / raw)
  To: initramfs; +Cc: Peter Jones

Hi,

On 11/24/2009 09:24 PM, Peter Jones wrote:
> 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(-)
>
> diff --git a/modules.d/90multipath/install b/modules.d/90multipath/install
> index d20ea38..52d69f5 100755
> --- a/modules.d/90multipath/install
> +++ b/modules.d/90multipath/install
> @@ -1,3 +1,5 @@
> +#!/bin/bash
> +
>   if [[ $hostonly ]]; then
>       inst /etc/multipath.conf
>   fi

Ack,

Regards,

hans

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 3/4] Make sure and get all the multipath related modules.
       [not found]   ` <4B0C40C7.7010206-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-11-25 10:23     ` Hans de Goede
  0 siblings, 0 replies; 21+ messages in thread
From: Hans de Goede @ 2009-11-25 10:23 UTC (permalink / raw)
  To: initramfs; +Cc: Peter Jones

Hi,

On 11/24/2009 09:23 PM, Peter Jones wrote:
> 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(-)
>
> diff --git a/modules.d/90multipath/installkernel b/modules.d/90multipath/installkernel
> index 50c7d6a..4a596f0 100755
> --- a/modules.d/90multipath/installkernel
> +++ b/modules.d/90multipath/installkernel
> @@ -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

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 4/4] Bring up multipath devices that are configured in multipath.conf.
       [not found]   ` <4B0C40ED.9000909-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-11-25 10:35     ` Hans de Goede
       [not found]       ` <4B0D087E.1030502-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 21+ messages in thread
From: Hans de Goede @ 2009-11-25 10:35 UTC (permalink / raw)
  To: initramfs; +Cc: Peter Jones

Hi,

On 11/24/2009 09:24 PM, Peter Jones wrote:
> 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
>
> diff --git a/modules.d/90multipath/14-multipath-scan.rules b/modules.d/90multipath/14-multipath-scan.rules
> new file mode 100644
> index 0000000..fcb8173
> --- /dev/null
> +++ b/modules.d/90multipath/14-multipath-scan.rules
> @@ -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.

> +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"
> diff --git a/modules.d/90multipath/install b/modules.d/90multipath/install
> index 52d69f5..9662848 100755
> --- a/modules.d/90multipath/install
> +++ b/modules.d/90multipath/install
> @@ -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"
> diff --git a/modules.d/90multipath/multipath-scan.sh b/modules.d/90multipath/multipath-scan.sh
> new file mode 100644
> index 0000000..0e1d3f2
> --- /dev/null
> +++ b/modules.d/90multipath/multipath-scan.sh
> @@ -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}
  command / where does it come from ?

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

Regards,

Hans

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 1/4] Use glob for libdir when installing multipath libraries.
       [not found]       ` <4B0D0531.2050401-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-11-25 15:10         ` Peter Jones
  0 siblings, 0 replies; 21+ messages in thread
From: Peter Jones @ 2009-11-25 15:10 UTC (permalink / raw)
  To: Hans de Goede; +Cc: initramfs

On 11/25/2009 05:21 AM, Hans de Goede wrote:
> Hi,
> 
> On 11/24/2009 09:23 PM, Peter Jones wrote:
>> 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(-)
>>
>> diff --git a/modules.d/90multipath/install
>> b/modules.d/90multipath/install
>> index 9552918..d20ea38 100755
>> --- a/modules.d/90multipath/install
>> +++ b/modules.d/90multipath/install
>> @@ -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
>>
> 
> 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 )

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.

-- 
        Peter

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

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 4/4] Bring up multipath devices that are configured in multipath.conf.
       [not found]       ` <4B0D087E.1030502-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-11-25 15:17         ` Peter Jones
       [not found]           ` <4B0D4A9F.1090606-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 21+ messages in thread
From: Peter Jones @ 2009-11-25 15:17 UTC (permalink / raw)
  To: Hans de Goede; +Cc: initramfs

On 11/25/2009 05:35 AM, Hans de Goede wrote:
> Hi,
> 
> On 11/24/2009 09:24 PM, Peter Jones wrote:
>> 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
>>
>> diff --git a/modules.d/90multipath/14-multipath-scan.rules
>> b/modules.d/90multipath/14-multipath-scan.rules
>> new file mode 100644
>> index 0000000..fcb8173
>> --- /dev/null
>> +++ b/modules.d/90multipath/14-multipath-scan.rules
>> @@ -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.

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.

-- 
        Peter

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

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Add support for bringing up multipath root devices [version 2]
       [not found]           ` <4B0D4A9F.1090606-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-11-25 15:25             ` Peter Jones
  2009-11-25 15:25             ` [PATCH 1/4] Use glob for libdir when installing multipath libraries Peter Jones
                               ` (3 subsequent siblings)
  4 siblings, 0 replies; 21+ messages in thread
From: Peter Jones @ 2009-11-25 15:25 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Hans de Goede

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.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 1/4] Use glob for libdir when installing multipath libraries.
       [not found]           ` <4B0D4A9F.1090606-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2009-11-25 15:25             ` Add support for bringing up multipath root devices [version 2] Peter Jones
@ 2009-11-25 15:25             ` Peter Jones
       [not found]               ` <1259162752-22372-2-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2009-11-25 15:25             ` [PATCH 2/4] Add #!/bin/bash for consistency Peter Jones
                               ` (2 subsequent siblings)
  4 siblings, 1 reply; 21+ messages in thread
From: Peter Jones @ 2009-11-25 15:25 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Hans de Goede, 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(-)

diff --git a/modules.d/90multipath/install b/modules.d/90multipath/install
index 9552918..4890825 100755
--- a/modules.d/90multipath/install
+++ b/modules.d/90multipath/install
@@ -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
 
-- 
1.6.5.2

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 2/4] Add #!/bin/bash for consistency.
       [not found]           ` <4B0D4A9F.1090606-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2009-11-25 15:25             ` Add support for bringing up multipath root devices [version 2] Peter Jones
  2009-11-25 15:25             ` [PATCH 1/4] Use glob for libdir when installing multipath libraries Peter Jones
@ 2009-11-25 15:25             ` Peter Jones
  2009-11-25 15:25             ` [PATCH 3/4] Make sure and get all the multipath related modules Peter Jones
  2009-11-25 15:25             ` [PATCH 4/4] Bring up multipath devices that are configured in multipath.conf Peter Jones
  4 siblings, 0 replies; 21+ messages in thread
From: Peter Jones @ 2009-11-25 15:25 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Hans de Goede, 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(-)

diff --git a/modules.d/90multipath/install b/modules.d/90multipath/install
index 4890825..499f7c9 100755
--- a/modules.d/90multipath/install
+++ b/modules.d/90multipath/install
@@ -1,3 +1,5 @@
+#!/bin/bash
+
 if [[ $hostonly ]]; then
     inst /etc/multipath.conf
 fi
-- 
1.6.5.2

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 3/4] Make sure and get all the multipath related modules.
       [not found]           ` <4B0D4A9F.1090606-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
                               ` (2 preceding siblings ...)
  2009-11-25 15:25             ` [PATCH 2/4] Add #!/bin/bash for consistency Peter Jones
@ 2009-11-25 15:25             ` Peter Jones
  2009-11-25 15:25             ` [PATCH 4/4] Bring up multipath devices that are configured in multipath.conf Peter Jones
  4 siblings, 0 replies; 21+ messages in thread
From: Peter Jones @ 2009-11-25 15:25 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Hans de Goede, 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(-)

diff --git a/modules.d/90multipath/installkernel b/modules.d/90multipath/installkernel
index 50c7d6a..4a596f0 100755
--- a/modules.d/90multipath/installkernel
+++ b/modules.d/90multipath/installkernel
@@ -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)
-- 
1.6.5.2

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 4/4] Bring up multipath devices that are configured in multipath.conf.
       [not found]           ` <4B0D4A9F.1090606-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
                               ` (3 preceding siblings ...)
  2009-11-25 15:25             ` [PATCH 3/4] Make sure and get all the multipath related modules Peter Jones
@ 2009-11-25 15:25             ` Peter Jones
       [not found]               ` <1259162752-22372-5-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  4 siblings, 1 reply; 21+ messages in thread
From: Peter Jones @ 2009-11-25 15:25 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Hans de Goede, 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

diff --git a/modules.d/90multipath/14-multipath-scan.rules b/modules.d/90multipath/14-multipath-scan.rules
new file mode 100644
index 0000000..b4acf57
--- /dev/null
+++ b/modules.d/90multipath/14-multipath-scan.rules
@@ -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"
diff --git a/modules.d/90multipath/install b/modules.d/90multipath/install
index 499f7c9..bafdd2c 100755
--- a/modules.d/90multipath/install
+++ b/modules.d/90multipath/install
@@ -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"
diff --git a/modules.d/90multipath/multipath-scan.sh b/modules.d/90multipath/multipath-scan.sh
new file mode 100644
index 0000000..0e1d3f2
--- /dev/null
+++ b/modules.d/90multipath/multipath-scan.sh
@@ -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}
-- 
1.6.5.2

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH 4/4] Bring up multipath devices that are configured in multipath.conf.
       [not found]                   ` <4B0D5306.8050706-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-11-25 15:52                     ` Peter Jones
  0 siblings, 0 replies; 21+ messages in thread
From: Peter Jones @ 2009-11-25 15:52 UTC (permalink / raw)
  To: Hans de Goede; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA

On 11/25/2009 10:53 AM, Hans de Goede wrote:
> Hi,
> 
> Patch 1-3 look good.
> 
> On 11/25/2009 04:25 PM, Peter Jones wrote:
>> 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
>>
>> diff --git a/modules.d/90multipath/14-multipath-scan.rules
>> b/modules.d/90multipath/14-multipath-scan.rules
>> new file mode 100644
>> index 0000000..b4acf57
>> --- /dev/null
>> +++ b/modules.d/90multipath/14-multipath-scan.rules
>> @@ -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.

It does not trigger a change event.

> 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


-- 
        Peter

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

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 1/4] Use glob for libdir when installing multipath libraries.
       [not found]               ` <1259162752-22372-2-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-11-25 15:52                 ` Peter Jones
  0 siblings, 0 replies; 21+ messages in thread
From: Peter Jones @ 2009-11-25 15:52 UTC (permalink / raw)
  To: Peter Jones; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA, Hans de Goede

On 11/25/2009 10:25 AM, Peter Jones wrote:
> 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(-)
> 
> diff --git a/modules.d/90multipath/install b/modules.d/90multipath/install
> index 9552918..4890825 100755
> --- a/modules.d/90multipath/install
> +++ b/modules.d/90multipath/install
> @@ -2,6 +2,12 @@ if [[ $hostonly ]]; then
>      inst /etc/multipath.conf
>  fi
>  
> +if ldd $(/sbin/multipath) |grep -q lib64; then

This is obviously wrong.

> +    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
>  


-- 
        Peter

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

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 4/4] Bring up multipath devices that are configured in multipath.conf.
       [not found]               ` <1259162752-22372-5-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-11-25 15:53                 ` Hans de Goede
       [not found]                   ` <4B0D5306.8050706-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 21+ messages in thread
From: Hans de Goede @ 2009-11-25 15:53 UTC (permalink / raw)
  To: Peter Jones; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA

Hi,

Patch 1-3 look good.

On 11/25/2009 04:25 PM, Peter Jones wrote:
> 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
>
> diff --git a/modules.d/90multipath/14-multipath-scan.rules b/modules.d/90multipath/14-multipath-scan.rules
> new file mode 100644
> index 0000000..b4acf57
> --- /dev/null
> +++ b/modules.d/90multipath/14-multipath-scan.rules
> @@ -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

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2009-11-25 15:53 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-24 19:52 Add support for bringing up multipath root devices Peter Jones
     [not found] ` <1259092378-14143-1-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-11-24 19:52   ` [PATCH 1/4] Use glob for libdir when installing multipath libraries Peter Jones
     [not found]     ` <1259092378-14143-2-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-11-24 19:55       ` Peter Jones
     [not found]         ` <4B0C3A19.3010509-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-11-24 19:59           ` Peter Jones
2009-11-24 19:52   ` [PATCH 2/4] Add #!/bin/bash for consistency Peter Jones
2009-11-24 19:52   ` [PATCH 3/4] Make sure and get all the multipath related modules Peter Jones
2009-11-24 19:52   ` [PATCH 4/4] Bring up multipath devices that are configured in multipath.conf Peter Jones
     [not found] ` <4B0C40BC.5000107@redhat.com>
     [not found]   ` <4B0C40BC.5000107-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-11-25 10:21     ` [PATCH 1/4] Use glob for libdir when installing multipath libraries Hans de Goede
     [not found]       ` <4B0D0531.2050401-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-11-25 15:10         ` Peter Jones
     [not found] ` <4B0C40E4.6080006@redhat.com>
     [not found]   ` <4B0C40E4.6080006-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-11-25 10:22     ` [PATCH 2/4] Add #!/bin/bash for consistency Hans de Goede
     [not found] ` <4B0C40C7.7010206@redhat.com>
     [not found]   ` <4B0C40C7.7010206-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-11-25 10:23     ` [PATCH 3/4] Make sure and get all the multipath related modules Hans de Goede
     [not found] ` <4B0C40ED.9000909@redhat.com>
     [not found]   ` <4B0C40ED.9000909-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-11-25 10:35     ` [PATCH 4/4] Bring up multipath devices that are configured in multipath.conf Hans de Goede
     [not found]       ` <4B0D087E.1030502-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-11-25 15:17         ` Peter Jones
     [not found]           ` <4B0D4A9F.1090606-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-11-25 15:25             ` Add support for bringing up multipath root devices [version 2] Peter Jones
2009-11-25 15:25             ` [PATCH 1/4] Use glob for libdir when installing multipath libraries Peter Jones
     [not found]               ` <1259162752-22372-2-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-11-25 15:52                 ` Peter Jones
2009-11-25 15:25             ` [PATCH 2/4] Add #!/bin/bash for consistency Peter Jones
2009-11-25 15:25             ` [PATCH 3/4] Make sure and get all the multipath related modules Peter Jones
2009-11-25 15:25             ` [PATCH 4/4] Bring up multipath devices that are configured in multipath.conf Peter Jones
     [not found]               ` <1259162752-22372-5-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-11-25 15:53                 ` Hans de Goede
     [not found]                   ` <4B0D5306.8050706-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-11-25 15:52                     ` Peter Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox