get kdump ifname once in kdump_install_net
Signed-off-by: Coiby Xu <coxu@redhat.com> Acked-by: Kairui Song <kasong@redhat.com
This commit is contained in:
parent
75bdcb7399
commit
afda4f4961
@ -480,7 +480,7 @@ kdump_get_remote_ip()
|
|||||||
# initramfs accessing giving destination
|
# initramfs accessing giving destination
|
||||||
# $1: destination host
|
# $1: destination host
|
||||||
kdump_install_net() {
|
kdump_install_net() {
|
||||||
local _destaddr _srcaddr _route _netdev
|
local _destaddr _srcaddr _route _netdev kdumpnic
|
||||||
local _static _proto _ip_conf _ip_opts _ifname_opts
|
local _static _proto _ip_conf _ip_opts _ifname_opts
|
||||||
|
|
||||||
_destaddr=$(kdump_get_remote_ip $1)
|
_destaddr=$(kdump_get_remote_ip $1)
|
||||||
@ -488,6 +488,7 @@ kdump_install_net() {
|
|||||||
_srcaddr=$(kdump_get_ip_route_field "$_route" "src")
|
_srcaddr=$(kdump_get_ip_route_field "$_route" "src")
|
||||||
_netdev=$(kdump_get_ip_route_field "$_route" "dev")
|
_netdev=$(kdump_get_ip_route_field "$_route" "dev")
|
||||||
_netmac=$(kdump_get_mac_addr $_netdev)
|
_netmac=$(kdump_get_mac_addr $_netdev)
|
||||||
|
kdumpnic=$(kdump_setup_ifname $_netdev)
|
||||||
|
|
||||||
if [ "$(uname -m)" = "s390x" ]; then
|
if [ "$(uname -m)" = "s390x" ]; then
|
||||||
kdump_setup_znet $_netdev
|
kdump_setup_znet $_netdev
|
||||||
@ -503,7 +504,7 @@ kdump_install_net() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
_ip_conf="${initdir}/etc/cmdline.d/40ip.conf"
|
_ip_conf="${initdir}/etc/cmdline.d/40ip.conf"
|
||||||
_ip_opts=" ip=${_static}$(kdump_setup_ifname $_netdev):${_proto}"
|
_ip_opts=" ip=${_static}$kdumpnic:${_proto}"
|
||||||
|
|
||||||
# dracut doesn't allow duplicated configuration for same NIC, even they're exactly the same.
|
# dracut doesn't allow duplicated configuration for same NIC, even they're exactly the same.
|
||||||
# so we have to avoid adding duplicates
|
# so we have to avoid adding duplicates
|
||||||
@ -523,7 +524,7 @@ kdump_install_net() {
|
|||||||
elif kdump_is_vlan "$_netdev"; then
|
elif kdump_is_vlan "$_netdev"; then
|
||||||
kdump_setup_vlan "$_netdev"
|
kdump_setup_vlan "$_netdev"
|
||||||
else
|
else
|
||||||
_ifname_opts=" ifname=$(kdump_setup_ifname $_netdev):$_netmac"
|
_ifname_opts=" ifname=$kdumpnic:$_netmac"
|
||||||
echo "$_ifname_opts" >> $_ip_conf
|
echo "$_ifname_opts" >> $_ip_conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -543,8 +544,8 @@ kdump_install_net() {
|
|||||||
# gateway.
|
# gateway.
|
||||||
if [ ! -f ${initdir}/etc/cmdline.d/60kdumpnic.conf ] &&
|
if [ ! -f ${initdir}/etc/cmdline.d/60kdumpnic.conf ] &&
|
||||||
[ ! -f ${initdir}/etc/cmdline.d/70bootdev.conf ]; then
|
[ ! -f ${initdir}/etc/cmdline.d/70bootdev.conf ]; then
|
||||||
echo "kdumpnic=$(kdump_setup_ifname $_netdev)" > ${initdir}/etc/cmdline.d/60kdumpnic.conf
|
echo "kdumpnic=$kdumpnic" > ${initdir}/etc/cmdline.d/60kdumpnic.conf
|
||||||
echo "bootdev=$(kdump_setup_ifname $_netdev)" > ${initdir}/etc/cmdline.d/70bootdev.conf
|
echo "bootdev=$kdumpnic" > ${initdir}/etc/cmdline.d/70bootdev.conf
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user