Wait for the network to be truly ready before dumping vmcore
nm-wait-online-initrd.service installed by dracut's 35-networkmanager module calls nm-online with "-s" which means it returns immediately when NetworkManager logs "startup complete". Thus it doesn't truly wait for network connectivity to be established [1]. Wait for the network to be truly ready before dumping vmcore. There are two benefits brought by this approach, - ssh/nfs dumping won't fail because of that the network is not ready e.g. [2][3] - users don't need to use workarounds like rd.net.carrier.timeout to make sure the network is ready [1] https://bugzilla.redhat.com/show_bug.cgi?id=1485712 [2] https://bugzilla.redhat.com/show_bug.cgi?id=1909014 [3] https://bugzilla.redhat.com/show_bug.cgi?id=2035451 Signed-off-by: Coiby Xu <coxu@redhat.com> Reviewed-by: Thomas Haller <thaller@redhat.com> Reviewed-by: Philipp Rudo <prudo@redhat.com>
This commit is contained in:
parent
568623e69a
commit
9792994f2f
@ -482,6 +482,26 @@ save_vmcore_dmesg_ssh()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wait_online_network()
|
||||||
|
{
|
||||||
|
# In some cases, network may still not be ready because nm-online is called
|
||||||
|
# with "-s" which means to wait for NetworkManager startup to complete, rather
|
||||||
|
# than waiting for network connectivity specifically. Wait 10mins more for the
|
||||||
|
# network to be truely ready in these cases.
|
||||||
|
_loop=0
|
||||||
|
while [ $_loop -lt 600 ]; do
|
||||||
|
sleep 1
|
||||||
|
_loop=$((_loop + 1))
|
||||||
|
if _route=$(kdump_get_ip_route "$1" 2> /dev/null); then
|
||||||
|
printf "%s" "$_route"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
derror "Oops. The network still isn't ready after waiting 10mins."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
get_host_ip()
|
get_host_ip()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -495,7 +515,11 @@ get_host_ip()
|
|||||||
derror "failed to get remote IP address!"
|
derror "failed to get remote IP address!"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
_route=$(kdump_get_ip_route "$_kdump_remote_ip")
|
|
||||||
|
if ! _route=$(wait_online_network "$_kdump_remote_ip"); then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
_netdev=$(kdump_get_ip_route_field "$_route" "dev")
|
_netdev=$(kdump_get_ip_route_field "$_route" "dev")
|
||||||
|
|
||||||
if ! _kdumpip=$(ip addr show dev "$_netdev" | grep '[ ]*inet'); then
|
if ! _kdumpip=$(ip addr show dev "$_netdev" | grep '[ ]*inet'); then
|
||||||
|
Loading…
Reference in New Issue
Block a user