check the existence of /sys/bus/ccwgroup/devices before trying to find online network device

/sys/bus/ccwgroup/devices doesn't exist for non-s390x machines which leads to
the warning "find: '/sys/bus/ccwgroup/devices': No such file or directory".
This warning can be eliminated by checking the existence of
"/sys/bus/ccwgroup/devices" beforehand.

Fixes: commit 7d47251568
       ("Iterate /sys/bus/ccwgroup/devices to tell if we should set up rd.znet")

Reported-by: Ruowen Qin <ruqin@redhat.com>
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1974618
Signed-off-by: Coiby Xu <coxu@redhat.com>
Acked-by: Kairui Song <kasong@redhat.com>
This commit is contained in:
Coiby Xu 2021-06-28 18:37:10 +08:00 committed by Kairui Song
parent 50bb8b701f
commit 03f9b91351

View File

@ -467,7 +467,9 @@ kdump_setup_vlan() {
find_online_znet_device() {
local CCWGROUPBUS_DEVICEDIR="/sys/bus/ccwgroup/devices"
local NETWORK_DEVICES d ifname ONLINE
NETWORK_DEVICES=$(find $CCWGROUPBUS_DEVICEDIR -type l)
[ ! -d "$CCWGROUPBUS_DEVICEDIR" ] && return
NETWORK_DEVICES=$(find $CCWGROUPBUS_DEVICEDIR)
for d in $NETWORK_DEVICES
do
read ONLINE < $d/online