From 88c0ba0f3204d8ef0042a3d9ec4d7bbca1fb9483 Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Thu, 25 Jan 2007 20:13:28 +0000 Subject: [PATCH] Updating kdump.init and mkdumprd to equiv. of -163.el5 --- kdump.conf | 3 ++- kdump.init | 9 ++++++++- kexec-tools.spec | 5 ++++- mkdumprd | 51 ++++++++++++++++++++++++++++++++++++++++-------- 4 files changed, 57 insertions(+), 11 deletions(-) diff --git a/kdump.conf b/kdump.conf index 19858ce..92d462f 100644 --- a/kdump.conf +++ b/kdump.conf @@ -44,7 +44,8 @@ # initramfs will wait before attempting to transmit # user data. # default -# if all of the above fail, do the default action. +# Action to preform instead of mounting root fs and +# running init process # reboot: If the default action is reboot simply reboot # the system and loose the core that you are # trying to retrieve. diff --git a/kdump.init b/kdump.init index 32ca8b2..476971d 100644 --- a/kdump.init +++ b/kdump.init @@ -154,6 +154,13 @@ function load_kdump() KDUMP_COMMANDLINE=`cat /proc/cmdline` fi + MEM_RESERVED=`echo $KDUMP_COMMANDLINE | grep "crashkernel=[0-9]\+[MmKkGg]@[0-9]\+[MmGgKk]"` + if [ -z "$MEM_RESERVED" ] + then + $LOGGER "No crashkernel parameter specified for running kernel" + return 1 + fi + ARCH=`uname -m` if [ "$ARCH" == "i686" -o "$ARCH" == "i386" ] then @@ -179,7 +186,7 @@ function load_kdump() fi fi - KDUMP_COMMANDLINE=`echo $KDUMP_COMMANDLINE | sed -e 's/crashkernel=[0-9]\+M@[0-9]\+M//g'` + KDUMP_COMMANDLINE=`echo $KDUMP_COMMANDLINE | sed -e 's/crashkernel=[0-9]\+[MmKkGg]@[0-9]\+[MmGgKk]//'` KDUMP_COMMANDLINE="${KDUMP_COMMANDLINE} ${KDUMP_COMMANDLINE_APPEND}" $KEXEC $KEXEC_ARGS $standard_kexec_args \ diff --git a/kexec-tools.spec b/kexec-tools.spec index 82fb7dc..1939333 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -1,6 +1,6 @@ Name: kexec-tools Version: 1.101 -Release: 56%{?dist} +Release: 57%{?dist} License: GPL Group: Applications/System Summary: The kexec/kdump userspace component. @@ -224,6 +224,9 @@ rm -f %{_datadir}/firstboot/modules/firstboot_kdump.py %doc kexec-kdump-howto.txt %changelog +* Wed Jan 25 2007 Neil Horman - 1.101-55%{dist} +- Updating kdump.init and mkdumprd with most recent RHEL5 fixes + * Thu Jan 04 2007 Neil Horman - 1.101-56%{dist} - Fix option parsing problem for bzImage files (bz 221272) diff --git a/mkdumprd b/mkdumprd index ac51476..558597e 100644 --- a/mkdumprd +++ b/mkdumprd @@ -45,8 +45,6 @@ DMRAIDS="" MPATHS="" -[ -e /etc/sysconfig/mkinitrd ] && . /etc/sysconfig/mkinitrd - CONFMODS="$MODULES" MODULES="" @@ -68,7 +66,7 @@ fstab="/etc/fstab" vg_list="" net_list="" -USING_METHOD="local_fs" +USING_METHOD="" SAVE_PATH=/var/crash vecho() @@ -406,6 +404,11 @@ handlenetdev() { then echo " " netmask $NETMASK >> $MNTIMAGE/etc/network/interfaces fi + if [ -z "$GATEWAY" ] + then + GATEWAY=`/sbin/ip route show | awk '/^default/ {print $3}'` + fi + echo " " gateway $GATEWAY >> $MNTIMAGE/etc/network/interfaces fi #This lets us recursively handle stacked devices @@ -909,6 +912,7 @@ if [ -n "$KDUMP_CONFIG_FILE" ]; then #don't process comments or blank line continue fi + USING_METHOD="filesystem" if (echo $location | egrep -q "^(LABEL|UUID)="); then location=$(findfs $location) fi @@ -925,7 +929,14 @@ if [ -n "$CORE_COLLECTOR" ]; then rm -rf $MNTIMAGE rm -rf $IMAGE exit 1 - fi + fi + + if [ -z "$USING_METHOD" ] + then + echo "Warning! Lack of dump target specification means core_collector option is ignored!" + CORE_COLLECTOR="" + fi + fi @@ -1459,12 +1470,17 @@ if [ -n "$KDUMP_CONFIG_FILE" ]; then #test raw partition kdump_chk "dd if=$location count=1 of=/dev/null > /dev/null 2>&1" \ "Bad raw partition $location" - #TODO check for available size is greater than $memtotal + #check for available size is greater than $memtotal + available_size=$(fdisk -s $location) + if [ $available_size -lt $memtotal ]; then + echo "Warning: There is not space enough to save a vmcore." + echo " The size of $location should be much greater than $memtotal bytes." + fi #setup raw case emit "echo Saving to partition $location" emit "dd if=/proc/vmcore of=$location" - emit "if [ $? == 0 ]" + emit "if [ \$? == 0 ]" emit "then" emit " reboot -f" emit "fi" @@ -1526,6 +1542,7 @@ if [ -n "$KDUMP_CONFIG_FILE" ]; then "Bad NFS mount $location" mkdir -p $tmnt/$SAVE_PATH tdir=`mktemp -dqp $tmnt/$SAVE_PATH` + available_size=$(df $tdir | tail -1 | tr -s ' ' ':' | cut -d: -f4) rc=$? && rm -rf $tdir umount $tmnt @@ -1543,7 +1560,11 @@ if [ -n "$KDUMP_CONFIG_FILE" ]; then CORE_COLLECTOR="cp" fi - #TODO check for available size is greater than $memtotal + #check for available size is greater than $memtotal + if [ $available_size -lt $memtotal ]; then + echo "Warning: There is not space enough to save a vmcore." + echo " The size of $location should be much greater than $memtotal bytes." + fi #setup nfs case mkdir -p $MNTIMAGE/mnt @@ -1571,6 +1592,14 @@ if [ -n "$KDUMP_CONFIG_FILE" ]; then echo "$KDUMP_CONFIG_FILE: Could not create temp directory in $location:$SAVE_PATH" exit 1 fi + remote_df=`ssh -q $s_opts $rlocation df $tdir` + available_size=$(echo $remote_df | tail -1 | tr -s ' ' '|' | cut -d\| -f10) + + #check for available size is greater than $memtotal + if [ $available_size -lt $memtotal ]; then + echo "Warning: There is not space enough to save a vmcore." + echo " The size of $rlocation:$tdir should be much greater than $memtotal bytes." + fi #We do this to remove the temp directory from above ssh -q $s_opts $rlocation rmdir $tdir @@ -1606,12 +1635,18 @@ if [ -n "$KDUMP_CONFIG_FILE" ]; then kdump_chk "mount -t $type $location /mnt" "Bad mount point $location" mkdir -p /mnt/$SAVE_PATH tdir=`mktemp -dqp /mnt/$SAVE_PATH` + available_size=$(df $tdir | tail -1 | tr -s ' ' ':' | cut -d: -f4) rc=$? && rm -rf $tdir && umount /mnt if [ $rc != "0" ]; then echo "Cannot create directory in $location: $SAVE_PATH" exit 1 fi - #TODO check for available size is greater than $memtotal + #check for available size is greater than $memtotal + if [ $available_size -lt $memtotal ]; then + echo "Warning: There is not space enough to save a vmcore." + echo " The size of $location should be much greater than $memtotal bytes." + fi + #setup filesystem case mkdir -p $MNTIMAGE/mnt