On Fri, Jul 18, 2014 at 04:15:32PM +0800, WANG Chao wrote:
[..]
+# These variables and functions are useful in 2nd kernel
+
+. /lib/kdump-lib.sh
+
+KDUMP_PATH="/var/crash"
+CORE_COLLECTOR="makedumpfile -l --message-level 1 -d 31"
+DMESG_COLLECTOR="/sbin/vmcore-dmesg"
+DEFAULT_ACTION="reboot -f"
+SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
+KDUMP_PRE=""
+KDUMP_POST=""
+DATEDIR=`date +%Y.%m.%d-%T`
+HOST_IP='127.0.0.1'
+DUMP_INSTRUCTION=""
+KDUMP_SCRIPT_DIR="/kdumpscripts"
+DD_BLKSIZE=512
+KDUMP_CONF="/etc/kdump.conf"
+NEWROOT="/sysroot"
+
+get_kdump_confs()
+{
+ local config_opt config_val
+ local user_specified_cc
+
+ while read config_opt config_val;
+ do
+ # remove inline comments after the end of a directive.
+ config_val=$(strip_comments $config_val)
+ case "$config_opt" in
+ path)
+ KDUMP_PATH="$config_val"
+ ;;
+ core_collector)
+ CORE_COLLECTOR="$config_val"
+ user_specified_cc=yes
+ ;;
+ sshkey)
+ SSH_KEY_LOCATION=$config_val
+ ;;
+ kdump_pre)
+ KDUMP_PRE="$config_val"
+ ;;
+ kdump_post)
+ KDUMP_POST="$config_val"
+ ;;
+ fence_kdump_args)
+ FENCE_KDUMP_ARGS="$config_val"
+ ;;
+ fence_kdump_nodes)
+ FENCE_KDUMP_NODES="$config_val"
+ ;;
+ default)
+ case $config_val in
+ shell)
+ DEFAULT_ACTION="kdump_emergency_shell"
+ ;;
+ reboot)
+ DEFAULT_ACTION="do_umount; reboot -f"
+ ;;
+ halt)
+ DEFAULT_ACTION="do_umount; halt -f"
+ ;;
+ poweroff)
+ DEFAULT_ACTION="do_umount; poweroff -f"
+ ;;
+ dump_to_rootfs)
+ DEFAULT_ACTION="dump_to_rootfs"
+ ;;
+ esac
+ ;;
+ esac
+ done < $KDUMP_CONF
+
+ if is_ssh_dump_target || is_raw_dump_target; then
+ if [ -z "$user_specified_cc" ]; then
+ CORE_COLLECTOR="$CORE_COLLECTOR -F"
+ fi
+ fi
+}
I feel that there are 3 places where we are parsing kdump.conf. First
in kdumpctl and then in mkdumprd and finally dracut-kdump.sh. At some
point of time, we should look into greater code unification for parsing
kdump.conf file. So for the time being it should be fine, but we need
to keep this in mind and do some cleanup whenever we have some free
cycles.
[..]
+kdump_emergency_shell()
+{
+ echo "PS1=\"kdump:\\\${PWD}# \"" >/etc/profile
+ /bin/dracut-emergency
+ rm -f /etc/profile
+}
+
+do_umount()
+{
+ umount -Rf /sysroot
+}
So definition of do_umount() changed from original one. I think these
kind of changes should go in a separate patch with explanation of why
we are chaning it.
So one patch should be just movement of variables and code from
dracut-kdump.sh to respective library. And then later patches should
change any functions/definitions with explanations of why we are
changing those.
I just happened to notice it otherwise patch review becomes difficult
and I have no idea what other functions might have changed from origional
definition (until and unless I compare each and every function).
Thanks
Vivek