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()
|
is_ssh_dump_target()
|
||||||
{
|
{
|
||||||
grep -q "^net.*@" $conf_file
|
grep -q "^ssh.*@" $conf_file
|
||||||
}
|
}
|
||||||
|
|
||||||
is_raw_dump_target()
|
is_raw_dump_target()
|
||||||
@ -203,19 +203,15 @@ read_kdump_conf()
|
|||||||
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)
|
ext[234]|xfs|btrfs|minix|nfs)
|
||||||
add_dump_code "dump_fs $config_val"
|
add_dump_code "dump_fs $config_val"
|
||||||
;;
|
;;
|
||||||
raw)
|
raw)
|
||||||
add_dump_code "dump_raw $config_val"
|
add_dump_code "dump_raw $config_val"
|
||||||
;;
|
;;
|
||||||
net)
|
ssh)
|
||||||
wait_for_net_ok
|
wait_for_net_ok
|
||||||
if [[ "$config_val" =~ "@" ]]; then
|
|
||||||
add_dump_code "dump_ssh $SSH_KEY_LOCATION $config_val"
|
add_dump_code "dump_ssh $SSH_KEY_LOCATION $config_val"
|
||||||
else
|
|
||||||
add_dump_code "dump_fs $config_val"
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done < $conf_file
|
done < $conf_file
|
||||||
|
@ -195,7 +195,7 @@ kdump_install_conf() {
|
|||||||
ext[234]|xfs|btrfs|minix|raw)
|
ext[234]|xfs|btrfs|minix|raw)
|
||||||
sed -i -e "s#$config_val#/dev/$(kdump_to_udev_name $config_val)#" /tmp/$$-kdump.conf
|
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_install_net "$config_val"
|
||||||
;;
|
;;
|
||||||
kdump_pre|kdump_post|extra_bins)
|
kdump_pre|kdump_post|extra_bins)
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
# Basics commands supported are:
|
# Basics commands supported are:
|
||||||
# raw <partition> - Will dd /proc/vmcore into <partition>.
|
# 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.
|
# <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
|
# <user@server>:/var/crash/%HOST-%DATE/, supports DNS
|
||||||
# NOTE: make sure user has necessary write
|
# NOTE: make sure user has necessary write
|
||||||
# permissions on server
|
# permissions on server
|
||||||
@ -108,8 +108,8 @@
|
|||||||
#ext4 /dev/sda3
|
#ext4 /dev/sda3
|
||||||
#ext4 LABEL=/boot
|
#ext4 LABEL=/boot
|
||||||
#ext4 UUID=03138356-5e61-4ab3-b58e-27507ac41937
|
#ext4 UUID=03138356-5e61-4ab3-b58e-27507ac41937
|
||||||
#net my.server.com:/export/tmp
|
#nfs my.server.com:/export/tmp
|
||||||
#net user@my.server.com
|
#ssh user@my.server.com
|
||||||
#sshkey /root/.ssh/kdump_id_rsa
|
#sshkey /root/.ssh/kdump_id_rsa
|
||||||
#blacklist cfg80211
|
#blacklist cfg80211
|
||||||
path /var/crash
|
path /var/crash
|
||||||
|
@ -28,14 +28,14 @@ understand how this configuration file affects the behavior of kdump.
|
|||||||
Will dd /proc/vmcore into <partition>.
|
Will dd /proc/vmcore into <partition>.
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
.B net <nfs mount>
|
.B nfs <nfs mount>
|
||||||
.RS
|
.RS
|
||||||
Will mount fs and copy /proc/vmcore to <mnt>/var/crash/%HOST-%DATE/,
|
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
|
supports DNS. Note that a fqdn should be used as the server name in the
|
||||||
mount point
|
mount point
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
.B net <user@server>
|
.B ssh <user@server>
|
||||||
.RS
|
.RS
|
||||||
Will scp /proc/vmcore to <user@server>:/var/crash/%HOST-%DATE/,
|
Will scp /proc/vmcore to <user@server>:/var/crash/%HOST-%DATE/,
|
||||||
supports DNS. NOTE: make sure user has necessary write permissions on
|
supports DNS. NOTE: make sure user has necessary write permissions on
|
||||||
|
4
kdumpctl
4
kdumpctl
@ -224,7 +224,7 @@ function check_ssh_config()
|
|||||||
path)
|
path)
|
||||||
SAVE_PATH=$config_val
|
SAVE_PATH=$config_val
|
||||||
;;
|
;;
|
||||||
net)
|
ssh)
|
||||||
DUMP_TARGET=$config_val
|
DUMP_TARGET=$config_val
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@ -355,7 +355,7 @@ function save_raw()
|
|||||||
function start()
|
function start()
|
||||||
{
|
{
|
||||||
local nr
|
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 ] && {
|
[ $nr -gt 1 ] && {
|
||||||
echo -n "Error: More than one dump targets specified"; echo
|
echo -n "Error: More than one dump targets specified"; echo
|
||||||
return 1
|
return 1
|
||||||
|
@ -375,7 +375,7 @@ Remote system via ssh/scp
|
|||||||
|
|
||||||
Dumping over ssh/scp requires setting up passwordless ssh keys for every
|
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
|
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
|
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
|
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
|
account on the target system is recommended, as there will be keyless ssh
|
||||||
|
20
mkdumprd
20
mkdumprd
@ -130,7 +130,7 @@ check_size() {
|
|||||||
|
|
||||||
is_ssh_dump_target()
|
is_ssh_dump_target()
|
||||||
{
|
{
|
||||||
grep -q "^net.*@" $conf_file
|
grep -q "^ssh.*@" $conf_file
|
||||||
}
|
}
|
||||||
|
|
||||||
is_raw_dump_target()
|
is_raw_dump_target()
|
||||||
@ -183,7 +183,10 @@ do
|
|||||||
extra_modules)
|
extra_modules)
|
||||||
extra_modules="$extra_modules $config_val"
|
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"
|
add_mount "$config_val"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Dump target $config_val is probably not mounted."
|
echo "Dump target $config_val is probably not mounted."
|
||||||
@ -199,21 +202,20 @@ do
|
|||||||
}
|
}
|
||||||
check_size raw $config_val
|
check_size raw $config_val
|
||||||
;;
|
;;
|
||||||
net)
|
ssh)
|
||||||
if strstr "$config_val" "@";
|
if strstr "$config_val" "@";
|
||||||
then
|
then
|
||||||
check_size ssh $config_val
|
check_size ssh $config_val
|
||||||
add_dracut_module "ssh-client"
|
add_dracut_module "ssh-client"
|
||||||
add_dracut_sshkey "$SSH_KEY_LOCATION"
|
add_dracut_sshkey "$SSH_KEY_LOCATION"
|
||||||
else
|
else
|
||||||
add_dracut_module "nfs"
|
echo "Bad ssh dump target $config_val"
|
||||||
add_mount "$config_val"
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Dump target $config_val is probably not mounted."
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
check_size fs $config_val
|
;;
|
||||||
fi
|
net)
|
||||||
|
echo "net option is not supported anymore, please use nfs|ssh instead."
|
||||||
|
exit 1
|
||||||
;;
|
;;
|
||||||
core_collector)
|
core_collector)
|
||||||
verify_core_collector "$config_val"
|
verify_core_collector "$config_val"
|
||||||
|
Loading…
Reference in New Issue
Block a user