mkdumprd: handle lvm in pre-pivot hook

This commit is contained in:
Amerigo Wang 2011-08-02 14:00:50 +08:00
parent 7a4f7d02be
commit 9ea3801214
4 changed files with 25 additions and 12 deletions

View File

@ -31,7 +31,7 @@ add_to_fstab()
while read dev mp fs opts rest; do while read dev mp fs opts rest; do
if [ "$dev" = "$1" ]; then if [ "$dev" = "$1" ]; then
_mp=$NEWROOT$mp _mp=$NEWROOT$mp
echo "$dev $NEWROOT$mp $fs ${opts},ro $rest" echo "$dev $NEWROOT$mp $fs ${opts},rw $rest"
break break
fi fi
done < "$NEWROOT/etc/fstab" >> /etc/fstab done < "$NEWROOT/etc/fstab" >> /etc/fstab
@ -60,7 +60,7 @@ dump_localfs()
mount $_mp || return 1 mount $_mp || return 1
mkdir -p $_mp/$KDUMP_PATH/$DATEDIR mkdir -p $_mp/$KDUMP_PATH/$DATEDIR
$CORE_COLLECTOR /proc/vmcore $_mp/$KDUMP_PATH/$DATEDIR/vmcore || return 1 $CORE_COLLECTOR /proc/vmcore $_mp/$KDUMP_PATH/$DATEDIR/vmcore || return 1
umount /mnt || return 1 umount $_mp || return 1
return 0 return 0
} }

View File

@ -52,8 +52,7 @@ pull_dracut_modules() {
unset MAJOR MINOR unset MAJOR MINOR
} }
to_udev_name() to_udev_name() {
{
local dev="$1" local dev="$1"
case "$dev" in case "$dev" in
@ -67,6 +66,15 @@ to_udev_name()
echo ${dev#/dev/} echo ${dev#/dev/}
} }
add_lvm_code() {
local dev="/dev/$(to_udev_name $1)"
local lv
printf '#!/bin/sh\n' > $moddir/kdump-prepare.sh
printf "lvm lvchange -ay --sysinit ">> $moddir/kdump-prepare.sh
lv=$(lvm lvdisplay $dev | awk '/LV Name/ {print $3}')
echo ${lv#/dev/} >> $moddir/kdump-prepare.sh
}
udevmatch() { udevmatch() {
case "$1" in case "$1" in
UUID=????????-????-????-????-????????????|LABEL=*) UUID=????????-????-????-????-????????????|LABEL=*)
@ -80,9 +88,8 @@ udevmatch() {
printf ', SYMLINK+="'$(to_udev_name $1)'"\n' printf ', SYMLINK+="'$(to_udev_name $1)'"\n'
} }
add_udev_rules() add_udev_rules() {
{ udevmatch $1 >> $moddir/90-localfs.rules
udevmatch $1 >> $moddir/99-localfs.rules
} }
depends() { depends() {
@ -100,12 +107,14 @@ depends() {
} }
install() { install() {
echo -n "" > "$moddir/99-localfs.rules" echo -n "" > $moddir/90-localfs.rules
chmod +x $moddir/kdump-prepare.sh
while read config_opt config_val; while read config_opt config_val;
do do
case "$config_opt" in case "$config_opt" in
ext[234]|xfs|btrfs|minix|raw) ext[234]|xfs|btrfs|minix|raw)
add_udev_rules $config_val add_udev_rules $config_val
add_lvm_code $config_val
;; ;;
esac esac
done < /etc/kdump.conf done < /etc/kdump.conf
@ -114,7 +123,8 @@ install() {
inst "/bin/sync" "/bin/sync" inst "/bin/sync" "/bin/sync"
inst "/sbin/makedumpfile" "/sbin/makedumpfile" inst "/sbin/makedumpfile" "/sbin/makedumpfile"
inst "/etc/kdump.conf" "/etc/kdump.conf" inst "/etc/kdump.conf" "/etc/kdump.conf"
inst_hook pre-pivot 01 "$moddir/kdump.sh" inst_hook pre-pivot 01 "$moddir/kdump-prepare.sh"
inst_rules "$moddir/99-localfs.rules" inst_hook pre-pivot 02 "$moddir/kdump.sh"
inst_rules "$moddir/90-localfs.rules"
} }

View File

@ -1,6 +1,6 @@
Name: kexec-tools Name: kexec-tools
Version: 2.0.2 Version: 2.0.2
Release: 21%{?dist} Release: 22%{?dist}
License: GPLv2 License: GPLv2
Group: Applications/System Group: Applications/System
Summary: The kexec/kdump userspace component. Summary: The kexec/kdump userspace component.
@ -280,6 +280,9 @@ done
%changelog %changelog
* Tue Aug 2 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-22
- Handle lvm in pre-pivot hook.
* Tue Aug 2 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-21 * Tue Aug 2 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-21
- Fix udev rules in module-setup.sh - Fix udev rules in module-setup.sh

View File

@ -2,4 +2,4 @@ d9f2ecd3c3307905f24130a25816e6cc kexec-tools-2.0.0.tar.bz2
3e802d638dce0080b910f15908c04a24 kexec-tools-po.tar.gz 3e802d638dce0080b910f15908c04a24 kexec-tools-po.tar.gz
e3a813bd6d7dace903a05c1296e20d57 makedumpfile-1.3.5.tar.gz e3a813bd6d7dace903a05c1296e20d57 makedumpfile-1.3.5.tar.gz
8e359dd03731b93a2082bd37cc2a4a4c kexec-tools-2.0.2.tar.bz2 8e359dd03731b93a2082bd37cc2a4a4c kexec-tools-2.0.2.tar.bz2
e781db40f39c3f27c6003d9c5794b862 dracut-files.tbz2 ed5b216591c1913eeac70449ca810cf7 dracut-files.tbz2