From 86aaceb714215cb6cbda2b214b345bc176240743 Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Fri, 2 Oct 2026 13:47:08 -0300 Subject: [PATCH] fix(xcat-core): read the NIC configuration from the file NetworkManager reports confignetwork_secondarynic_nicextraparams_updatenode fails on EL8 because the dump nic_cfg.sh prints carries no extra params, although configeth wrote CONNECTED_MODE and the node has it. nm_show resolves the connection's backend file by globbing /etc/NetworkManager/system-connections for the UUID. The keyfile plugin keeps a connection there, and on EL9 and EL10 it is the only plugin. On EL8 the ifcfg-rh plugin owns the connection and keeps it under /etc/sysconfig/network-scripts, so the glob matches nothing and no file is dumped. Every check that greps the dump for a value nm_show does not normalize then sees nothing. Ask NetworkManager for the path through the UUID,FILENAME fields and keep the glob as a fallback. Read the MTU from either spelling, because a keyfile writes "mtu=" and an ifcfg file "MTU=". Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- .../autotest/testcase/commoncmd/nic_cfg.sh | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/xCAT-test/autotest/testcase/commoncmd/nic_cfg.sh b/xCAT-test/autotest/testcase/commoncmd/nic_cfg.sh index bc6bb12db..363849375 100755 --- a/xCAT-test/autotest/testcase/commoncmd/nic_cfg.sh +++ b/xCAT-test/autotest/testcase/commoncmd/nic_cfg.sh @@ -53,15 +53,21 @@ detect_backend() { fi } -# Resolve a connection's on-disk keyfile path. NM names it "-.nmconnection" -# (not just ".nmconnection") whenever a same-named file already exists, so resolve by -# UUID rather than assuming the plain name. -nm_keyfile() { - local conn=$1 uuid +# Resolve a connection's on-disk file, which NM reports. The keyfile plugin keeps it under +# /etc/NetworkManager/system-connections; the ifcfg-rh plugin, which owns xCAT connections on +# EL8, keeps it under /etc/sysconfig/network-scripts. +# +# Resolve by UUID: NM names a keyfile "-.nmconnection", not ".nmconnection", +# whenever a same-named file already exists. +nm_conn_file() { + local conn=$1 uuid file uuid=$(nmcli -g connection.uuid connection show "$conn" 2>/dev/null) - if [ -n "$uuid" ]; then - grep -l "uuid=$uuid" "$NMDIR"/*.nmconnection 2>/dev/null | head -1 + [ -n "$uuid" ] || return 0 + file=$(nmcli -t -f UUID,FILENAME connection show 2>/dev/null | sed -n "s|^${uuid}:||p" | head -1) + if [ -z "$file" ]; then + file=$(grep -l "uuid=$uuid" "$NMDIR"/*.nmconnection 2>/dev/null | head -1) fi + printf '%s\n' "$file" } # Resolve the NetworkManager connection name bound to a device. @@ -101,14 +107,15 @@ nm_show() { done IFS="$oldifs" mtu=$(nmcli -g 802-3-ethernet.mtu connection show "$conn" 2>/dev/null) - kf=$(nm_keyfile "$conn") + kf=$(nm_conn_file "$conn") + # A keyfile spells it "mtu=", an ifcfg file "MTU=". if { [ -z "$mtu" ] || [ "$mtu" = "auto" ]; } && [ -n "$kf" ] && [ -r "$kf" ]; then - mtu=$(awk -F= '/^[[:space:]]*mtu=/{print $2; exit}' "$kf") + mtu=$(awk -F= '/^[[:space:]]*[Mm][Tt][Uu]=/{print $2; exit}' "$kf") fi [ -n "$mtu" ] && [ "$mtu" != "auto" ] && echo "MTU=$mtu" - # Raw keyfile so anything not normalized above (extra params, slaves, vlan id, ...) + # Raw backend file so anything not normalized above (extra params, slaves, vlan id, ...) # is still visible and greppable by the case's check: lines. - if [ -r "$kf" ]; then echo "# --- $kf ---"; cat "$kf"; fi + if [ -n "$kf" ] && [ -r "$kf" ]; then echo "# --- $kf ---"; cat "$kf"; fi } file_show() {