Upstream dracut have provided a parameter for adding mandantory network requirement by appending "rd.neednet" parameter, so we should use that instead.
See https://github.com/dracutdevs/dracut/pull/761/files
Kairui Song (2): Revert "Add a hook to wait for kdump target in initqueue" module-setup.sh: Add "rd.neednet" parameter if network is needed
dracut-kdump-wait-for-target.sh | 23 ---------------- dracut-kdump.sh | 49 +++++++++++++++++++++++++++++++++ dracut-module-setup.sh | 7 +++-- kdump-lib-initramfs.sh | 49 --------------------------------- kexec-tools.spec | 2 -- 5 files changed, 54 insertions(+), 76 deletions(-) delete mode 100755 dracut-kdump-wait-for-target.sh
This reverts commit cee618593c35443f3cf5dbce85cf5b04cbeb34de.
Upstream dracut have provided a parameter for adding mandantory network requirement by appending "rd.neednet" parameter, so we should use that instead.
Signed-off-by: Kairui Song kasong@redhat.com --- dracut-kdump-wait-for-target.sh | 23 ---------------- dracut-kdump.sh | 49 +++++++++++++++++++++++++++++++++ dracut-module-setup.sh | 2 -- kdump-lib-initramfs.sh | 49 --------------------------------- kexec-tools.spec | 2 -- 5 files changed, 49 insertions(+), 76 deletions(-) delete mode 100755 dracut-kdump-wait-for-target.sh
diff --git a/dracut-kdump-wait-for-target.sh b/dracut-kdump-wait-for-target.sh deleted file mode 100755 index ce984d0..0000000 --- a/dracut-kdump-wait-for-target.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/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 diff --git a/dracut-kdump.sh b/dracut-kdump.sh index 0f54ddc..8752178 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -141,6 +141,55 @@ 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) + config_val=$(get_mntpoint_from_target "$config_val") + 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 diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 5397eb5..1794c2c 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -811,9 +811,7 @@ 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
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh index ab78be3..c98a43b 100755 --- a/kdump-lib-initramfs.sh +++ b/kdump-lib-initramfs.sh @@ -219,52 +219,3 @@ 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) - config_val=$(get_mntpoint_from_target "$config_val") - 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)" -} diff --git a/kexec-tools.spec b/kexec-tools.spec index 6889e8a..2c9901e 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -50,7 +50,6 @@ 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 @@ -223,7 +222,6 @@ 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
Upstream dracut now use network-manager module by default and since upstream commit 3dcaa97, network-manager expects user to pass "rd.neednet" to indicate network is required.
Signed-off-by: Kairui Song kasong@redhat.com --- dracut-module-setup.sh | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 1794c2c..d3a674e 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -408,6 +408,11 @@ kdump_install_net() {
kdump_setup_dns "$_netdev"
+ if [ ! -f ${initdir}/etc/cmdline.d/50neednet.conf ]; then + # network-manager module needs this parameter + echo "rd.neednet" >> ${initdir}/etc/cmdline.d/50neednet.conf + fi + # Save netdev used for kdump as cmdline # Whoever calling kdump_install_net() is setting up the default gateway, # ie. bootdev/kdumpnic. So don't override the setting if calling
On 05/28/20 at 02:26am, Kairui Song wrote:
Upstream dracut have provided a parameter for adding mandantory network requirement by appending "rd.neednet" parameter, so we should use that instead.
See https://github.com/dracutdevs/dracut/pull/761/files
Kairui Song (2): Revert "Add a hook to wait for kdump target in initqueue" module-setup.sh: Add "rd.neednet" parameter if network is needed
dracut-kdump-wait-for-target.sh | 23 ---------------- dracut-kdump.sh | 49 +++++++++++++++++++++++++++++++++ dracut-module-setup.sh | 7 +++-- kdump-lib-initramfs.sh | 49 --------------------------------- kexec-tools.spec | 2 -- 5 files changed, 54 insertions(+), 76 deletions(-) delete mode 100755 dracut-kdump-wait-for-target.sh
-- 2.26.2 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org
Acked-by: Dave Young dyoung@redhat.com
Thanks Dave