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


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


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

View File

@ -15,3 +15,6 @@


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

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

View File

@ -13,7 +13,7 @@


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


%changelog %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 * Thu Sep 17 2009 Harald Hoyer <harald@redhat.com> 002-1
- version 002 - version 002
- set correct PATH - 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_RAIDS=$(getargs rd_DM_UUID=)


DM_CLEANUP="no"

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


View File

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


inst_rules "$moddir/61-dmraid-imsm.rules" inst_rules "$moddir/61-dmraid-imsm.rules"
inst_hook pre-pivot 30 "$moddir/dmraid-cleanup.sh" inst "$moddir/dmraid-cleanup.sh" /sbin/dmraid-cleanup
inst_hook pre-pivot 31 "$moddir/dmraid-cleanup.sh"
inst_hook pre-trigger 30 "$moddir/parse-dm.sh" 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 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 [ -f /etc/lvm/lvm.conf ] && inst /etc/lvm/lvm.conf
fi fi


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

View File

@ -31,5 +31,9 @@ fi
info "Scanning devices $lvmdevs for LVM volume groups $VGS" info "Scanning devices $lvmdevs for LVM volume groups $VGS"
lvm vgscan 2>&1 | vinfo lvm vgscan 2>&1 | vinfo
lvm vgchange -ay $VGS 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 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/mdadm_auto.sh" /sbin/mdadm_auto
inst "$moddir/md_finished.sh" /sbin/md_finished.sh inst "$moddir/md_finished.sh" /sbin/md_finished.sh
inst_hook pre-trigger 30 "$moddir/parse-md.sh" inst_hook pre-trigger 30 "$moddir/parse-md.sh"
inst_hook pre-pivot 30 "$moddir/mdraid-cleanup.sh" inst "$moddir/mdraid-cleanup.sh" /sbin/mdraid-cleanup
inst_hook pre-pivot 31 "$moddir/mdraid-cleanup.sh"

View File

@ -3,3 +3,5 @@


info "Autoassembling MD Raid" info "Autoassembling MD Raid"
/sbin/mdadm -As --auto=yes --run 2>&1 | vinfo /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 udevadm control --stop-exec-queue
# and activate any containers # and activate any containers
mdadm -IR $md 2>&1 | vinfo 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 udevadm control --start-exec-queue

View File

@ -5,4 +5,6 @@
info "Assembling MD RAID arrays" info "Assembling MD RAID arrays"
udevadm control --stop-exec-queue udevadm control --stop-exec-queue
mdadm -IRs 2>&1 | vinfo 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 udevadm control --start-exec-queue