Add a hook to wait for kdump target in initqueue
The dracut initqueue may quit immediately and won't trigger any hook if there is no "finished" hook still pending (finished hook will be deleted once it return 0). This issue start to appear with latest dracut, latest dracut use network-manager to configure the network, network-manager module only install "settled" hook, and we didn't install any other hook. So NFS/SSH dump will fail. iSCSI dump works because dracut iscsi module will install a "finished" hook to detect if the iscsi target is up. So for NFS/SSH we keep initqueue running until the host successfully get a valid IP address, which means the network is ready. Signed-off-by: Kairui Song <kasong@redhat.com> Acked-by: Pingfan Liu <piliu@redhat.com>
This commit is contained in:
parent
24b00298d0
commit
cee618593c
23
dracut-kdump-wait-for-target.sh
Executable file
23
dracut-kdump-wait-for-target.sh
Executable file
@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
# only wait if it's kdump kernel
|
||||
if [ -f /etc/fadump.initramfs ] && [ ! -f /proc/device-tree/rtas/ibm,kernel-dump ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
. /lib/kdump-lib-initramfs.sh
|
||||
|
||||
# For SSH/NFS target, need to wait for the network to setup
|
||||
if is_nfs_dump_target; then
|
||||
get_host_ip
|
||||
exit $?
|
||||
fi
|
||||
|
||||
if is_ssh_dump_target; then
|
||||
get_host_ip
|
||||
exit $?
|
||||
fi
|
||||
|
||||
# No need to wait for dump target
|
||||
exit 0
|
@ -114,54 +114,6 @@ save_vmcore_dmesg_ssh() {
|
||||
fi
|
||||
}
|
||||
|
||||
get_host_ip()
|
||||
{
|
||||
local _host
|
||||
if is_nfs_dump_target || is_ssh_dump_target
|
||||
then
|
||||
kdumpnic=$(getarg kdumpnic=)
|
||||
[ -z "$kdumpnic" ] && echo "kdump: failed to get kdumpnic!" && return 1
|
||||
_host=`ip addr show dev $kdumpnic|grep '[ ]*inet'`
|
||||
[ $? -ne 0 ] && echo "kdump: wrong kdumpnic: $kdumpnic" && return 1
|
||||
_host=`echo $_host | head -n 1 | cut -d' ' -f2`
|
||||
_host="${_host%%/*}"
|
||||
[ -z "$_host" ] && echo "kdump: wrong kdumpnic: $kdumpnic" && return 1
|
||||
HOST_IP=$_host
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
read_kdump_conf()
|
||||
{
|
||||
if [ ! -f "$KDUMP_CONF" ]; then
|
||||
echo "kdump: $KDUMP_CONF not found"
|
||||
return
|
||||
fi
|
||||
|
||||
get_kdump_confs
|
||||
|
||||
# rescan for add code for dump target
|
||||
while read config_opt config_val;
|
||||
do
|
||||
# remove inline comments after the end of a directive.
|
||||
case "$config_opt" in
|
||||
dracut_args)
|
||||
config_val=$(get_dracut_args_target "$config_val")
|
||||
[ -n "$config_val" ] && add_dump_code "dump_fs $config_val"
|
||||
;;
|
||||
ext[234]|xfs|btrfs|minix|nfs)
|
||||
add_dump_code "dump_fs $config_val"
|
||||
;;
|
||||
raw)
|
||||
add_dump_code "dump_raw $config_val"
|
||||
;;
|
||||
ssh)
|
||||
add_dump_code "dump_ssh $SSH_KEY_LOCATION $config_val"
|
||||
;;
|
||||
esac
|
||||
done <<< "$(read_strip_comments $KDUMP_CONF)"
|
||||
}
|
||||
|
||||
fence_kdump_notify()
|
||||
{
|
||||
if [ -n "$FENCE_KDUMP_NODES" ]; then
|
||||
|
@ -842,7 +842,9 @@ install() {
|
||||
kdump_check_iscsi_targets
|
||||
|
||||
# nfs/ssh dump will need to get host ip in second kernel and need to call 'ip' tool, see get_host_ip for more detail
|
||||
# also need to let initqueue wait for target to become ready
|
||||
if is_nfs_dump_target || is_ssh_dump_target; then
|
||||
inst_hook initqueue/finished 01 $moddir/kdump-wait-for-target.sh
|
||||
inst "ip"
|
||||
fi
|
||||
|
||||
|
@ -201,3 +201,51 @@ do_final_action()
|
||||
{
|
||||
eval $FINAL_ACTION
|
||||
}
|
||||
|
||||
get_host_ip()
|
||||
{
|
||||
local _host
|
||||
if is_nfs_dump_target || is_ssh_dump_target
|
||||
then
|
||||
kdumpnic=$(getarg kdumpnic=)
|
||||
[ -z "$kdumpnic" ] && echo "kdump: failed to get kdumpnic!" && return 1
|
||||
_host=`ip addr show dev $kdumpnic|grep '[ ]*inet'`
|
||||
[ $? -ne 0 ] && echo "kdump: wrong kdumpnic: $kdumpnic" && return 1
|
||||
_host=`echo $_host | head -n 1 | cut -d' ' -f2`
|
||||
_host="${_host%%/*}"
|
||||
[ -z "$_host" ] && echo "kdump: wrong kdumpnic: $kdumpnic" && return 1
|
||||
HOST_IP=$_host
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
read_kdump_conf()
|
||||
{
|
||||
if [ ! -f "$KDUMP_CONF" ]; then
|
||||
echo "kdump: $KDUMP_CONF not found"
|
||||
return
|
||||
fi
|
||||
|
||||
get_kdump_confs
|
||||
|
||||
# rescan for add code for dump target
|
||||
while read config_opt config_val;
|
||||
do
|
||||
# remove inline comments after the end of a directive.
|
||||
case "$config_opt" in
|
||||
dracut_args)
|
||||
config_val=$(get_dracut_args_target "$config_val")
|
||||
[ -n "$config_val" ] && add_dump_code "dump_fs $config_val"
|
||||
;;
|
||||
ext[234]|xfs|btrfs|minix|nfs)
|
||||
add_dump_code "dump_fs $config_val"
|
||||
;;
|
||||
raw)
|
||||
add_dump_code "dump_raw $config_val"
|
||||
;;
|
||||
ssh)
|
||||
add_dump_code "dump_ssh $SSH_KEY_LOCATION $config_val"
|
||||
;;
|
||||
esac
|
||||
done <<< "$(read_strip_comments $KDUMP_CONF)"
|
||||
}
|
||||
|
@ -50,6 +50,7 @@ Source106: dracut-kdump-capture.service
|
||||
Source107: dracut-kdump-emergency.target
|
||||
Source108: dracut-early-kdump.sh
|
||||
Source109: dracut-early-kdump-module-setup.sh
|
||||
Source110: dracut-kdump-wait-for-target.sh
|
||||
|
||||
Requires(post): systemd-units
|
||||
Requires(preun): systemd-units
|
||||
@ -225,6 +226,7 @@ cp %{SOURCE104} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpb
|
||||
cp %{SOURCE105} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE105}}
|
||||
cp %{SOURCE106} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE106}}
|
||||
cp %{SOURCE107} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE107}}
|
||||
cp %{SOURCE110} $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE110}}
|
||||
chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE100}}
|
||||
chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix %{SOURCE101}}
|
||||
mkdir -p -m755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99earlykdump
|
||||
|
Loading…
Reference in New Issue
Block a user