Looks good to me.
Hans de Goede wrote:
Hi all,
Use dmraid instead of setting up dm tables ourselves, this fixes stacked
dmraid's like raid10. As an added bonus this means dmraid will also stop
breaking when the disk numbering changes. This patch uses the new
--rm_partitions dmraid option to tell the kernel to remove the partitions
from the used disks, stopping programs probing partitons causing IO-errors
like those reported in bug 475384
Note that this patch also removes part of the (broken) multipath code,
which
was in the same code loop as the dyi dm table creation code for dmraid.
This
is not a problem, as multipath has never worked in Fedora.
---
mkinitrd | 117
+++++++++++--------------------------------------------------
1 files changed, 21 insertions(+), 96 deletions(-)
diff --git a/mkinitrd b/mkinitrd
index 211be1f..2ce03a7 100755
--- a/mkinitrd
+++ b/mkinitrd
@@ -60,7 +60,7 @@ PROBE="yes"
MODULES=""
GRAPHICSMODS=""
PREMODS=""
-DMDEVS=""
+DMRAIDS=""
ncryptodevs=0
ncryptoparts=0
ncryptolvs=0
@@ -130,10 +130,6 @@ qpopd() {
popd >/dev/null 2>&1
}
-dm_get_uuid() {
- echo nash-dm get_uuid "$1" | /sbin/nash --force --quiet
-}
-
resolve_device_name() {
echo nash-resolveDevice "$1" | /sbin/nash --forcequiet
}
@@ -560,6 +556,7 @@ handledm() {
EOF
local name=$(dmsetup info --noheadings -c -j $major -m $minor -o name)
local vg=$(lvshow "/dev/mapper/$name")
+ local raids=$(/sbin/dmraid -s -craidname 2>/dev/null | grep -vi "no
raid disks")
if [ -n "$vg" ]; then
vg=`echo $vg` # strip whitespace
case " $vg_list " in
@@ -569,6 +566,17 @@ EOF
;;
esac
fi
+ for raid in $raids ; do
+ if [ "$raid" == "$name" ]; then
+ case " $DMRAIDS " in
+ *" $raid "*) ;;
+ *) DMRAIDS="$DMRAIDS $raid"
+ [ -z "$nodmraid" ] && find_base_dm_mods
+ ;;
+ esac
+ break
+ fi
+ done
}
handleiscsi() {
@@ -1115,72 +1123,6 @@ if [ -n "${loopfs}" ] || [[ "$rootopts" =~ "loop"
]]; then
fi
fi
-# If we use LVM or dm-based raid, include dm-mod
-# XXX: dm not really supported yet.
-testdm=""
-[ -z "$nodmraid" ] && testdm="yes"
-[ "x$PROBE" != "xyes" ] && testdm=""
-
-if [ -n "$testdm" \
- -a -x /sbin/dmsetup \
- -a -x /sbin/dmraid \
- -a -e /dev/mapper/control ]; then
- dmout=$(/sbin/dmsetup ls 2>/dev/null)
- if [ "$dmout" != "No devices found" -a "$dmout" != "" ]; then
- RAIDS=$(/sbin/dmraid -s -craidname 2>/dev/null | grep -vi "no
raid disks")
-
- # I fucking hate shell.
- lineno=1
- PREV=""
- LINE=""
- while :; do
- PREV="$LINE"
- LINE=$(/sbin/dmsetup table | head -$lineno | tail -1)
- if [ "$LINE" == "$PREV" ]; then
- break;
- fi
-
- eval $(echo $LINE | \
- while read NAME START END TYPE TABLE ; do
- echo NAME=\"$(sed 's/:$//'<<< "$NAME")\"
- echo START=\"$START\"
- echo END=\"$END\"
- echo TYPE=\"$TYPE\"
- echo TABLE=\"$TABLE\"
- done)
-
- case "$TYPE" in
- multipath|emc)
- # ugggh. We could try to fish the module name out,
but it
- # requires real parsing...
- # XXX also covered by #132001
- for mod in $TABLE ; do
- DMMODS="$DMMODS $([[ "$mod" =~ "[[:alpha:]]" ]]
&& echo "$mod")"
- done
- DMDEVS="$DMDEVS $NAME"
- ;;
- *)
- for raid in $RAIDS ; do
- if [ "$raid" == "$NAME" ]; then
- DMDEVS="$DMDEVS $NAME"
- RAIDS=$(sed 's/ $NAME //' <<< "$RAIDS")
- break
- fi
- done
- ;;
- esac
- lineno=$(($lineno + 1))
- done
-
- [ -n "$DMDEVS" ] && find_base_dm_mods
-
- DMDEVS=$(tr ' ' '\n' <<< $DMDEVS | sort -u)
- for mod in $(tr ' ' '\n' <<< $DMMODS | sort -u) ; do
- findmodule -dm-$mod
- done
- fi
-fi
-
for n in $basicmodules; do
findmodule $n
done
@@ -1210,32 +1152,15 @@ emit()
echo $NONL "$@" >> $RCFILE
}
-emitdm()
+emitdmraids()
{
- vecho "Adding dm map \"$1\""
- UUID=$(dm_get_uuid "$1")
- if [ -n "$UUID" ]; then
- UUID="--uuid $UUID"
+ if [ -z "$nodmraid" -a -n "$DMRAIDS" ]; then
+ inst /sbin/dmraid "$MNTIMAGE" /sbin/dmraid
+ for raid in $DMRAIDS; do
+ vecho "Adding dmraid set: \"$raid\""
+ emit "/sbin/dmraid -a y -i --rm_partitions $raid"
+ done
fi
- emit dm create "$1" $UUID $(/sbin/dmsetup table "$1")
-}
-
-emitdms()
-{
- [ -z "$DMDEVS" ] && return 0
- echo dm list $DMDEVS | nash --force --quiet | while read ACTION
NAME ; do
- case $ACTION in
- rmparts)
- emit rmparts "$NAME"
- ;;
- create)
- emitdm "$NAME"
- ;;
- part)
- emit dm partadd "$NAME"
- ;;
- esac
- done
}
if [ -z "$MNTIMAGE" -o -z "$IMAGE" ]; then
@@ -1639,7 +1564,7 @@ fi
# things like RAID or LVM
emit "mkblkdevs"
-emitdms
+emitdmraids
emitcrypto()
{
--
David Cantrell <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list