Set up s390 znet cmdline by "nmcli --get-values"

Resolves: bz1919052
Upstream: Fedora
Conflict: None

commit 8b08b4f17ba0141eb9c78cb4d626adbdaee433f5
Author: Coiby Xu <coxu@redhat.com>
Date:   Thu Apr 1 15:32:11 2021 +0800

    Set up s390 znet cmdline by "nmcli --get-values"

    Now kdumpctl will abort when failing to set up znet.

    Signed-off-by: Coiby Xu <coxu@redhat.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
This commit is contained in:
Coiby Xu 2021-05-14 09:30:08 +08:00 committed by Tao Liu
parent b15a090483
commit d408ec02f0
1 changed files with 30 additions and 9 deletions

View File

@ -433,17 +433,33 @@ kdump_setup_vlan() {
}
# setup s390 znet cmdline
# $1: netdev name
# $1: netdev (ifname)
# $2: nmcli connection show output
kdump_setup_znet() {
local _netdev="$1"
local _nmcli_cmd="$2"
local s390_prefix="802-3-ethernet.s390-"
local _options=""
local _netdev=$1
local NETTYPE
local SUBCHANNELS
source_ifcfg_file $_netdev
NETTYPE=$(get_nmcli_value_by_field "$_nmcli_cmd" "${s390_prefix}nettype")
SUBCHANNELS=$(get_nmcli_value_by_field "$_nmcli_cmd" "${s390_prefix}subchannels")
_options=$(get_nmcli_value_by_field "$_nmcli_cmd" "${s390_prefix}options")
for i in $OPTIONS; do
_options=${_options},$i
done
echo rd.znet=${NETTYPE},${SUBCHANNELS}${_options} rd.znet_ifname=$_netdev:${SUBCHANNELS} > ${initdir}/etc/cmdline.d/30znet.conf
if [[ -z "$NETTYPE" || -z "$SUBCHANNELS" || -z "$_options" ]]; then
dwarning "Failed to get znet configuration via nmlci output. Now try sourcing ifcfg script."
source_ifcfg_file $_netdev
for i in $OPTIONS; do
_options=${_options},$i
done
fi
if [[ -z "$NETTYPE" || -z "$SUBCHANNELS" || -z "$_options" ]]; then
exit 1
fi
echo rd.znet=${NETTYPE},${SUBCHANNELS},${_options} rd.znet_ifname=$_netdev:${SUBCHANNELS} > ${initdir}/etc/cmdline.d/30znet.conf
}
kdump_get_ip_route()
@ -477,18 +493,23 @@ kdump_get_remote_ip()
# initramfs accessing giving destination
# $1: destination host
kdump_install_net() {
local _destaddr _srcaddr _route _netdev kdumpnic
local _destaddr _srcaddr _route _netdev _nm_show_cmd kdumpnic
local _static _proto _ip_conf _ip_opts _ifname_opts
_destaddr=$(kdump_get_remote_ip $1)
_route=$(kdump_get_ip_route $_destaddr)
_srcaddr=$(kdump_get_ip_route_field "$_route" "src")
_netdev=$(kdump_get_ip_route_field "$_route" "dev")
_nm_show_cmd=$(get_nmcli_connection_show_cmd_by_ifname "$_netdev")
_netmac=$(kdump_get_mac_addr $_netdev)
kdumpnic=$(kdump_setup_ifname $_netdev)
if [ "$(uname -m)" = "s390x" ]; then
kdump_setup_znet $_netdev
$(kdump_setup_znet "$_netdev" "$_nm_show_cmd")
if [[ $? != 0 ]]; then
derror "Failed to set up znet"
exit 1
fi
fi
_static=$(kdump_static_ip $_netdev $_srcaddr $kdumpnic)