Raw dump: use by-id as persistent policy in 2nd kernel

Although we use by-id in mkdumprd as persistent policy for the dump target
checking, finally it is not used in kdump 2nd kernel because we call dracut
function in module-setup.sh without persistent policy specified that means
kdump will copy default "by-uuid" dev name.

Though by-uuid usually works and it is still better to fix it as raw disk
uuid make no sense.

Also do not need to call bind mount adjust function for raw dump, here add
another switch case for raw dump and cleanup the functions with short
variable names to keep code shorter.

Signed-off-by: Dave Young <dyoung@redhat.com>
Reviewed-by: Xunlei Pang <xlpang@redhat.com>
This commit is contained in:
Dave Young 2016-11-17 12:52:35 +08:00
parent 631d979eb3
commit 3742e9d0c3

View File

@ -438,32 +438,38 @@ adjust_bind_mount_path()
#install kdump.conf and what user specifies in kdump.conf #install kdump.conf and what user specifies in kdump.conf
kdump_install_conf() { kdump_install_conf() {
local _opt _val _pdev
sed -ne '/^#/!p' /etc/kdump.conf > ${initdir}/tmp/$$-kdump.conf sed -ne '/^#/!p' /etc/kdump.conf > ${initdir}/tmp/$$-kdump.conf
while read config_opt config_val; while read _opt _val;
do do
# remove inline comments after the end of a directive. # remove inline comments after the end of a directive.
config_val=$(strip_comments $config_val) _val=$(strip_comments $_val)
case "$config_opt" in case "$_opt" in
ext[234]|xfs|btrfs|minix|raw) raw)
sed -i -e "s#^$config_opt[[:space:]]\+$config_val#$config_opt $(kdump_to_udev_name $config_val)#" ${initdir}/tmp/$$-kdump.conf _pdev=$(persistent_policy="by-id" kdump_to_udev_name $_val)
sed -i -e "s#^$_opt[[:space:]]\+$_val#$_opt $_pdev#" ${initdir}/tmp/$$-kdump.conf
;;
ext[234]|xfs|btrfs|minix)
_pdev=$(kdump_to_udev_name $_val)
sed -i -e "s#^$_opt[[:space:]]\+$_val#$_opt $_pdev#" ${initdir}/tmp/$$-kdump.conf
if is_atomic; then if is_atomic; then
adjust_bind_mount_path "$config_val" adjust_bind_mount_path "$_val"
fi fi
;; ;;
ssh|nfs) ssh|nfs)
kdump_install_net "$config_val" kdump_install_net "$_val"
;; ;;
dracut_args) dracut_args)
if [[ $(get_dracut_args_fstype "$config_val") = nfs* ]] ; then if [[ $(get_dracut_args_fstype "$_val") = nfs* ]] ; then
kdump_install_net "$(get_dracut_args_target "$config_val")" kdump_install_net "$(get_dracut_args_target "$_val")"
fi fi
;; ;;
kdump_pre|kdump_post|extra_bins) kdump_pre|kdump_post|extra_bins)
dracut_install $config_val dracut_install $_val
;; ;;
core_collector) core_collector)
dracut_install "${config_val%%[[:blank:]]*}" dracut_install "${_val%%[[:blank:]]*}"
;; ;;
esac esac
done < /etc/kdump.conf done < /etc/kdump.conf