refactor net option
Currently net options means either nfs or ssh dump. Better to split these two into standalone options. That's more clear to user. after the split, ssh dump need user specify "ssh user@host" nfs dump need user specify "nfs host:nfsshare" Signed-off-by: Dave Young <dyoung@redhat.com> Acked-by: Vivek Goyal <vgoyal@redhat.com>
This commit is contained in:
parent
5e85d20d34
commit
b47c0915d2
@ -144,7 +144,7 @@ dump_ssh()
|
||||
|
||||
is_ssh_dump_target()
|
||||
{
|
||||
grep -q "^net.*@" $conf_file
|
||||
grep -q "^ssh.*@" $conf_file
|
||||
}
|
||||
|
||||
is_raw_dump_target()
|
||||
@ -203,19 +203,15 @@ read_kdump_conf()
|
||||
while read config_opt config_val;
|
||||
do
|
||||
case "$config_opt" in
|
||||
ext[234]|xfs|btrfs|minix)
|
||||
ext[234]|xfs|btrfs|minix|nfs)
|
||||
add_dump_code "dump_fs $config_val"
|
||||
;;
|
||||
raw)
|
||||
add_dump_code "dump_raw $config_val"
|
||||
;;
|
||||
net)
|
||||
ssh)
|
||||
wait_for_net_ok
|
||||
if [[ "$config_val" =~ "@" ]]; then
|
||||
add_dump_code "dump_ssh $SSH_KEY_LOCATION $config_val"
|
||||
else
|
||||
add_dump_code "dump_fs $config_val"
|
||||
fi
|
||||
add_dump_code "dump_ssh $SSH_KEY_LOCATION $config_val"
|
||||
;;
|
||||
esac
|
||||
done < $conf_file
|
||||
|
@ -195,7 +195,7 @@ kdump_install_conf() {
|
||||
ext[234]|xfs|btrfs|minix|raw)
|
||||
sed -i -e "s#$config_val#/dev/$(kdump_to_udev_name $config_val)#" /tmp/$$-kdump.conf
|
||||
;;
|
||||
net)
|
||||
ssh|nfs)
|
||||
kdump_install_net "$config_val"
|
||||
;;
|
||||
kdump_pre|kdump_post|extra_bins)
|
||||
|
@ -13,10 +13,10 @@
|
||||
# Basics commands supported are:
|
||||
# raw <partition> - Will dd /proc/vmcore into <partition>.
|
||||
#
|
||||
# net <nfs mount> - Will mount fs and copy /proc/vmcore to
|
||||
# nfs <nfs mount> - Will mount fs and copy /proc/vmcore to
|
||||
# <mnt>/var/crash/%HOST-%DATE/, supports DNS.
|
||||
#
|
||||
# net <user@server> - Will scp /proc/vmcore to
|
||||
# ssh <user@server> - Will scp /proc/vmcore to
|
||||
# <user@server>:/var/crash/%HOST-%DATE/, supports DNS
|
||||
# NOTE: make sure user has necessary write
|
||||
# permissions on server
|
||||
@ -108,8 +108,8 @@
|
||||
#ext4 /dev/sda3
|
||||
#ext4 LABEL=/boot
|
||||
#ext4 UUID=03138356-5e61-4ab3-b58e-27507ac41937
|
||||
#net my.server.com:/export/tmp
|
||||
#net user@my.server.com
|
||||
#nfs my.server.com:/export/tmp
|
||||
#ssh user@my.server.com
|
||||
#sshkey /root/.ssh/kdump_id_rsa
|
||||
#blacklist cfg80211
|
||||
path /var/crash
|
||||
|
@ -28,14 +28,14 @@ understand how this configuration file affects the behavior of kdump.
|
||||
Will dd /proc/vmcore into <partition>.
|
||||
.RE
|
||||
|
||||
.B net <nfs mount>
|
||||
.B nfs <nfs mount>
|
||||
.RS
|
||||
Will mount fs and copy /proc/vmcore to <mnt>/var/crash/%HOST-%DATE/,
|
||||
supports DNS. Note that a fqdn should be used as the server name in the
|
||||
mount point
|
||||
.RE
|
||||
|
||||
.B net <user@server>
|
||||
.B ssh <user@server>
|
||||
.RS
|
||||
Will scp /proc/vmcore to <user@server>:/var/crash/%HOST-%DATE/,
|
||||
supports DNS. NOTE: make sure user has necessary write permissions on
|
||||
|
4
kdumpctl
4
kdumpctl
@ -224,7 +224,7 @@ function check_ssh_config()
|
||||
path)
|
||||
SAVE_PATH=$config_val
|
||||
;;
|
||||
net)
|
||||
ssh)
|
||||
DUMP_TARGET=$config_val
|
||||
;;
|
||||
*)
|
||||
@ -355,7 +355,7 @@ function save_raw()
|
||||
function start()
|
||||
{
|
||||
local nr
|
||||
nr=$(awk 'BEGIN{cnt=0} /^raw|^net|^ext[234]|^xfs|^btrfs|^minix/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE)
|
||||
nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh|^nfs|^ext[234]|^xfs|^btrfs|^minix/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE)
|
||||
[ $nr -gt 1 ] && {
|
||||
echo -n "Error: More than one dump targets specified"; echo
|
||||
return 1
|
||||
|
@ -375,7 +375,7 @@ Remote system via ssh/scp
|
||||
|
||||
Dumping over ssh/scp requires setting up passwordless ssh keys for every
|
||||
machine you wish to have dump via this method. First up, configure kdump.conf
|
||||
for ssh/scp dumping, adding a config line of 'net user@server', where 'user'
|
||||
for ssh/scp dumping, adding a config line of 'ssh user@server', where 'user'
|
||||
can be any user on the target system you choose, and 'server' is the host
|
||||
name or IP address of the target system. Using a dedicated, restricted user
|
||||
account on the target system is recommended, as there will be keyless ssh
|
||||
|
22
mkdumprd
22
mkdumprd
@ -130,7 +130,7 @@ check_size() {
|
||||
|
||||
is_ssh_dump_target()
|
||||
{
|
||||
grep -q "^net.*@" $conf_file
|
||||
grep -q "^ssh.*@" $conf_file
|
||||
}
|
||||
|
||||
is_raw_dump_target()
|
||||
@ -183,7 +183,10 @@ do
|
||||
extra_modules)
|
||||
extra_modules="$extra_modules $config_val"
|
||||
;;
|
||||
ext[234]|xfs|btrfs|minix)
|
||||
ext[234]|xfs|btrfs|minix|nfs)
|
||||
if [ "$config_opt" = "nfs" ]; then
|
||||
add_dracut_module "nfs"
|
||||
fi
|
||||
add_mount "$config_val"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Dump target $config_val is probably not mounted."
|
||||
@ -199,22 +202,21 @@ do
|
||||
}
|
||||
check_size raw $config_val
|
||||
;;
|
||||
net)
|
||||
ssh)
|
||||
if strstr "$config_val" "@";
|
||||
then
|
||||
check_size ssh $config_val
|
||||
add_dracut_module "ssh-client"
|
||||
add_dracut_sshkey "$SSH_KEY_LOCATION"
|
||||
else
|
||||
add_dracut_module "nfs"
|
||||
add_mount "$config_val"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Dump target $config_val is probably not mounted."
|
||||
exit 1
|
||||
fi
|
||||
check_size fs $config_val
|
||||
echo "Bad ssh dump target $config_val"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
net)
|
||||
echo "net option is not supported anymore, please use nfs|ssh instead."
|
||||
exit 1
|
||||
;;
|
||||
core_collector)
|
||||
verify_core_collector "$config_val"
|
||||
;;
|
||||
|
Loading…
Reference in New Issue
Block a user