lsluns: print a message if no adapter or port exists

lsluns lists nothing and returns with return code 0 if no adapter (FCP
device) or target port exists in sysfs. This can be confusing for the user.

Print a message if no adapter exists. Print a message if no port exists on
any adapter.

Reported-by: Thorsten Diehl <thorsten.diehl@de.ibm.com>
Suggested-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Reviewed-by: Steffen Maier <maier@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Jens Remus
2018-02-20 10:22:41 +01:00
committed by Jan Höppner
parent dec58c349e
commit d868ce5ec7
2 changed files with 9 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ Release history for s390-tools (MIT version)
Changes of existing tools:
Bug Fixes:
- lsluns: Print a message if no adapter or port exists
* __v2.4.0 (2018-05-07)__

View File

@@ -235,8 +235,15 @@ sub get_env_list
my @res ;
my %res_hash;
if (!</sys/bus/ccw/drivers/zfcp/*.*.*/>) {
print "$PROGRAM_NAME: No adapter exists\n";
return;
}
@res = </sys/bus/ccw/drivers/zfcp/*.*.*/0x*>;
return () if (!@res);
if (!@res) {
print "$PROGRAM_NAME: No port on any adapter exists\n";
return;
}
foreach my $entry (@res) {
my $a = ${[split('/', $entry)]}[-2];
my $p = ${[split('/', $entry)]}[-1];