From eba744a25edcc7202068c1d46fd99d4c98c1acf2 Mon Sep 17 00:00:00 2001 From: Steffen Maier Date: Fri, 8 Jun 2018 19:21:07 +0200 Subject: [PATCH] lsluns: fix to prevent error messages if there are non-zfcp SCSI devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Simply skip non-zfcp SCSI devices, such as iSCSI or virtio-scsi-ccw, to not erroneously access absent zfcp-specific sysfs attributes. Signed-off-by: Steffen Maier Reviewed-by: Hendrik Brueckner Reviewed-by: Jens Remus Signed-off-by: Jan Höppner --- zconf/lsluns | 14 +++++++++----- zconf/lsluns.8 | 5 ++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/zconf/lsluns b/zconf/lsluns index f88aa0f6..bfe48f10 100755 --- a/zconf/lsluns +++ b/zconf/lsluns @@ -2,7 +2,7 @@ # # lsluns - list LUNs discovered in the FC SAN, or show encryption state of attached LUNs # -# Copyright IBM Corp. 2008, 2017 +# Copyright IBM Corp. 2008, 2018 # # s390-tools is free software; you can redistribute it and/or modify # it under the terms of the MIT license. See LICENSE for details. @@ -152,6 +152,11 @@ sub get_lun_hash my %lun_hash; foreach my $device () { + # skip non-zfcp SCSI devices and avoid file access error messages + next unless -r "$device/device/fcp_lun"; + next unless -r "$device/device/wwpn"; + next unless -r "$device/device/hba_id"; + my $l = `cat $device/device/fcp_lun`; my $p = `cat $device/device/wwpn`; my $a = `cat $device/device/hba_id`; @@ -170,9 +175,8 @@ sub get_lun_hash sub lsluns_usage { print <] ... [-p ] ... [-h] [-v] @@ -220,7 +224,7 @@ EOD sub lsluns_version { print "$PROGRAM_NAME: version %S390_TOOLS_VERSION%\n"; - print "Copyright IBM Corp. 2008, 2017\n"; + print "Copyright IBM Corp. 2008, 2018\n"; } sub lsluns_invalid_usage { diff --git a/zconf/lsluns.8 b/zconf/lsluns.8 index cca649a0..a4a1849a 100644 --- a/zconf/lsluns.8 +++ b/zconf/lsluns.8 @@ -28,9 +28,8 @@ zfcp-attached LUNs .SH DESCRIPTION .PP -This tool is designed for environments where all SCSI devices are attached -through the zfcp device driver. Expect error messages in mixed environments -such as with iSCSI. +This tool is designed for environments with SCSI devices attached +through the zfcp device driver. .B lsluns lists all logical unit numbers (LUNs) discovered in the