]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
90mdraid: add "--offroot" support
authorHarald Hoyer <harald@redhat.com>
Mon, 13 Feb 2012 20:16:31 +0000 (21:16 +0100)
committerHarald Hoyer <harald@redhat.com>
Mon, 13 Feb 2012 20:16:31 +0000 (21:16 +0100)
modules.d/90mdraid/65-md-incremental-imsm.rules
modules.d/90mdraid/md-shutdown.sh
modules.d/90mdraid/mdraid-cleanup.sh
modules.d/90mdraid/mdraid-waitclean.sh
modules.d/90mdraid/mdraid_start.sh
modules.d/90mdraid/parse-md.sh

index 80e6aab7db52a22f3e5c4f7e537911f44aeb9ffe..c4334dbdb807d53a6aa6d9ca837a49ab0fb1c50d 100644 (file)
@@ -35,6 +35,6 @@ RUN+="/sbin/initqueue --timeout --name 50-mdraid_start --onetime --unique /sbin/
 #
 LABEL="md_incremental"
 
-RUN+="/sbin/mdadm -I $env{DEVNAME}"
+RUN+="/sbin/mdadm $env{rd_MD_OFFROOT} -I $env{DEVNAME}"
 
 LABEL="md_end"
index bc36166403d047842e3e157397e99c134d5a0b5f..0d41008c8dce6282c9e941ba09c239e9ef16cb2d 100755 (executable)
@@ -4,8 +4,9 @@
 _do_md_shutdown() {
     local ret
     local final=$1
+    local _offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot)
     info "Disassembling mdraid devices."
-    mdadm -v --stop --scan 
+    mdadm $_offroot -v --stop --scan
     ret=$?
     if [ "x$final" != "x" ]; then
         info "cat /proc/mdstat"
index 2e8a389dea801b6eedf5cb3c14a1cf7500b25efb..9c4bc18c79a71b0da4de7be2ed566246bbdf37b1 100755 (executable)
@@ -4,6 +4,7 @@
 
 type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
 
+_offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot)
 containers=""
 for md in /dev/md[0-9_]*; do
     [ -b "$md" ] || continue
@@ -13,11 +14,11 @@ for md in /dev/md[0-9_]*; do
         containers="$containers $md"
         continue
     fi
-    mdadm -S "$md" >/dev/null 2>&1 || need_shutdown
+    mdadm $_offroot -S "$md" >/dev/null 2>&1 || need_shutdown
 done
 
 for md in $containers; do
-    mdadm -S "$md" >/dev/null 2>&1 || need_shutdown
+    mdadm $_offroot -S "$md" >/dev/null 2>&1 || need_shutdown
 done
 
-unset containers udevinfo
+unset containers udevinfo _offroot
index 2f2a7535a90a72a0cec68868f5471c5dec504153..68204dd6fe2770cd2a1aed0c640595e6b570b21c 100755 (executable)
@@ -3,6 +3,7 @@
 # ex: ts=8 sw=4 sts=4 et filetype=sh
 
 if getargbool 0 rd.md.waitclean; then
+    _offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot)
     type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
     containers=""
     for md in /dev/md[0-9_]*; do
@@ -14,13 +15,13 @@ if getargbool 0 rd.md.waitclean; then
             continue
         fi
         info "Waiting for $md to become clean"
-        mdadm -W "$md" >/dev/null 2>&1
+        mdadm $_offroot -W "$md" >/dev/null 2>&1
     done
 
     for md in $containers; do
         info "Waiting for $md to become clean"
-        mdadm -W "$md" >/dev/null 2>&1
+        mdadm $_offroot -W "$md" >/dev/null 2>&1
     done
 
-    unset containers udevinfo
+    unset containers udevinfo _offroot
 fi
index f4b7ad0c299f8e2eb6e684369b7b8e3ef4e76d7c..545a8354ecdc68a32032e9cb7401ae0da3377cb7 100755 (executable)
@@ -7,6 +7,8 @@ _md_force_run() {
     local _udevinfo
     local _path_s
     local _path_d
+    local _offroot
+    _offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot)
     # try to force-run anything not running yet
     for md in /dev/md[0-9_]*; do
         [ -b "$md" ] || continue
@@ -20,7 +22,7 @@ _md_force_run() {
         # inactive ?
         [ "$(cat "$_path_s")" != "inactive" ] && continue
 
-        mdadm -R "$md" 2>&1 | vinfo
+        mdadm $_offroot -R "$md" 2>&1 | vinfo
 
         # still inactive ?
         [ "$(cat "$_path_s")" = "inactive" ] && continue
@@ -29,7 +31,7 @@ _md_force_run() {
         [ ! -r "$_path_d" ] && continue
 
         # workaround for mdmon bug
-        [ "$(cat "$_path_d")" -gt "0" ] && mdmon --takeover "$md"
+        [ "$(cat "$_path_d")" -gt "0" ] && mdmon $_offroot --takeover "$md"
     done
 }
 
index b85a3a3f17f380e6b15e525cbd5cfd49daf16ce4..1482f2f16d343d79dce8c69d8c8a6d1a09f179f9 100755 (executable)
@@ -51,3 +51,5 @@ if ! getargbool 1 rd.md.ddf -n rd_NO_MDDDF || getarg noddfmd || getarg nodmraid;
     info "no MD RAID for SNIA ddf raids"
     udevproperty rd_NO_MDDDF=1
 fi
+
+strstr "$(mdadm --help-options 2>&1)" offroot && udevproperty rd_MD_OFFROOT=--offroot