md/dm/lvm: install pre-pivot cleanup hooks only if actually needed

- removed dmraid cleanup
- only call lvm cleanup, if no lvm.conf provided
- copy over lvm.conf by default
- add --nolvmconf --lvmconf parameters
master
Harald Hoyer 2009-09-18 11:40:12 +02:00
parent 2727e45b43
commit 7a34efa5c4
12 changed files with 32 additions and 12 deletions

7
dracut
View File

@ -47,6 +47,8 @@ Creates initial ramdisk images for preloading modules
--nostrip Do not strip binaries in the initramfs
--mdadmconf Include local /etc/mdadm.conf
--nomdadmconf Do not include local /etc/mdadm.conf
--lvmconf Include local /etc/lvm/lvm.conf
--nolvmconf Do not include local /etc/lvm/lvm.conf
-h, --help This message
--debug Output debug information of the build process
-v, --verbose Verbose output during the build process
@ -82,6 +84,8 @@ while (($# > 0)); do
--nostrip) do_strip_l="no";;
--mdadmconf) mdadmconf_l="yes";;
--nomdadmconf) mdadmconf_l="no";;
--lvmconf) lvmconf_l="yes";;
--nolvmconf) lvmconf_l="no";;
-h|--help) usage; exit 1 ;;
--debug) debug="yes";;
-v|--verbose) beverbose="yes";;
@ -121,6 +125,7 @@ export PATH
[[ $do_strip_l ]] && do_strip=$do_strip_l
[[ $hostonly_l ]] && hostonly=$hostonly_l
[[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l
[[ $lvmconf_l ]] && lvmconf=$lvmconf_l
[[ $dracutbasedir ]] || dracutbasedir=/usr/share/dracut
[[ $fw_dir ]] || fw_dir=/lib/firmware
[[ $do_strip ]] || do_strip=yes
@ -169,7 +174,7 @@ chmod 755 "$initdir"

export initdir hookdirs dsrc dracutmodules drivers \
fw_dir drivers_dir debug beverbose no_kernel kernel_only \
add_drivers mdadmconf
add_drivers mdadmconf lvmconf

if [[ $kernel_only != yes ]]; then
# Create some directory structure first

View File

@ -15,3 +15,6 @@

# install local /etc/mdadm.conf
mdadmconf="yes"

# install local /etc/lvm/lvm.conf
lvmconf="yes"

View File

@ -13,7 +13,7 @@

Name: dracut
Version: 002
Release: 1%{?rdist}
Release: 2%{?rdist}
Summary: Initramfs generator using udev
Group: System Environment/Base
License: GPLv2+
@ -180,6 +180,10 @@ rm -rf $RPM_BUILD_ROOT
%dir /var/lib/dracut/overlay

%changelog
* Fri Sep 18 2009 Harald Hoyer <harald@redhat.com> 002-2
- do not cleanup dmraids
- copy over lvm.conf

* Thu Sep 17 2009 Harald Hoyer <harald@redhat.com> 002-1
- version 002
- set correct PATH

View File

@ -1,2 +0,0 @@
# close everything which is not busy
dmraid -an >/dev/null 2>&1

View File

@ -4,6 +4,8 @@

DM_RAIDS=$(getargs rd_DM_UUID=)

DM_CLEANUP="no"

# run dmraid if udev has settled
info "Scanning for dmraid devices $DM_RAIDS"
SETS=$(dmraid -c -s)
@ -35,3 +37,4 @@ else
[ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s" 2>&1 | vinfo
done
fi


View File

@ -7,7 +7,6 @@ if [ ! -x /lib/udev/vol_id ]; then
fi

inst_rules "$moddir/61-dmraid-imsm.rules"
inst_hook pre-pivot 30 "$moddir/dmraid-cleanup.sh"
inst_hook pre-pivot 31 "$moddir/dmraid-cleanup.sh"
inst "$moddir/dmraid-cleanup.sh" /sbin/dmraid-cleanup
inst_hook pre-trigger 30 "$moddir/parse-dm.sh"


View File

@ -3,11 +3,10 @@ inst lvm

inst_rules "$moddir/64-lvm.rules" 64-lvm.rules

if [[ $hostonly ]]; then
if [[ $hostonly ]] || [[ $lvmconf = "yes" ]]; then
[ -f /etc/lvm/lvm.conf ] && inst /etc/lvm/lvm.conf
fi

inst "$moddir/lvm_scan.sh" /sbin/lvm_scan
inst_hook cmdline 30 "$moddir/parse-lvm.sh"
inst_hook pre-pivot 30 "$moddir/lvm-cleanup.sh"
inst_hook pre-pivot 31 "$moddir/lvm-cleanup.sh"
inst "$moddir/lvm-cleanup.sh" /sbin/lvm-cleanup

View File

@ -31,5 +31,9 @@ fi
info "Scanning devices $lvmdevs for LVM volume groups $VGS"
lvm vgscan 2>&1 | vinfo
lvm vgchange -ay $VGS 2>&1 | vinfo
[ "$lvmwritten" ] && rm -f /etc/lvm/lvm.conf
if [ "$lvmwritten" ]; then
rm -f /etc/lvm/lvm.conf
ln -s /sbin/lvm-cleanup /pre-pivot/30-lvm-cleanup.sh 2>/dev/null
ln -s /sbin/lvm-cleanup /pre-pivot/31-lvm-cleanup.sh 2>/dev/null
fi
unset lvmwritten

View File

@ -36,5 +36,4 @@ inst "$moddir/mdcontainer_start.sh" /sbin/mdcontainer_start
inst "$moddir/mdadm_auto.sh" /sbin/mdadm_auto
inst "$moddir/md_finished.sh" /sbin/md_finished.sh
inst_hook pre-trigger 30 "$moddir/parse-md.sh"
inst_hook pre-pivot 30 "$moddir/mdraid-cleanup.sh"
inst_hook pre-pivot 31 "$moddir/mdraid-cleanup.sh"
inst "$moddir/mdraid-cleanup.sh" /sbin/mdraid-cleanup

View File

@ -3,3 +3,5 @@

info "Autoassembling MD Raid"
/sbin/mdadm -As --auto=yes --run 2>&1 | vinfo
ln -s /sbin/mdraid-cleanup /pre-pivot/30-mdraid-cleanup.sh 2>/dev/null
ln -s /sbin/mdraid-cleanup /pre-pivot/31-mdraid-cleanup.sh 2>/dev/null

View File

@ -5,4 +5,6 @@ md=$1
udevadm control --stop-exec-queue
# and activate any containers
mdadm -IR $md 2>&1 | vinfo
ln -s /sbin/mdraid-cleanup /pre-pivot/30-mdraid-cleanup.sh 2>/dev/null
ln -s /sbin/mdraid-cleanup /pre-pivot/31-mdraid-cleanup.sh 2>/dev/null
udevadm control --start-exec-queue

View File

@ -5,4 +5,6 @@
info "Assembling MD RAID arrays"
udevadm control --stop-exec-queue
mdadm -IRs 2>&1 | vinfo
ln -s /sbin/mdraid-cleanup /pre-pivot/30-mdraid-cleanup.sh 2>/dev/null
ln -s /sbin/mdraid-cleanup /pre-pivot/31-mdraid-cleanup.sh 2>/dev/null
udevadm control --start-exec-queue