Browse Source

90mdraid: add "--offroot" support

master
Harald Hoyer 13 years ago
parent
commit
e539fa9980
  1. 2
      modules.d/90mdraid/65-md-incremental-imsm.rules
  2. 3
      modules.d/90mdraid/md-shutdown.sh
  3. 7
      modules.d/90mdraid/mdraid-cleanup.sh
  4. 7
      modules.d/90mdraid/mdraid-waitclean.sh
  5. 6
      modules.d/90mdraid/mdraid_start.sh
  6. 2
      modules.d/90mdraid/parse-md.sh

2
modules.d/90mdraid/65-md-incremental-imsm.rules

@ -35,6 +35,6 @@ RUN+="/sbin/initqueue --timeout --name 50-mdraid_start --onetime --unique /sbin/ @@ -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"

3
modules.d/90mdraid/md-shutdown.sh

@ -4,8 +4,9 @@ @@ -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"

7
modules.d/90mdraid/mdraid-cleanup.sh

@ -4,6 +4,7 @@ @@ -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 @@ -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

7
modules.d/90mdraid/mdraid-waitclean.sh

@ -3,6 +3,7 @@ @@ -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 @@ -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

6
modules.d/90mdraid/mdraid_start.sh

@ -7,6 +7,8 @@ _md_force_run() { @@ -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() { @@ -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() { @@ -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
}


2
modules.d/90mdraid/parse-md.sh

@ -51,3 +51,5 @@ if ! getargbool 1 rd.md.ddf -n rd_NO_MDDDF || getarg noddfmd || getarg nodmraid; @@ -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

Loading…
Cancel
Save