From d868ce5ec7df2cfb1a6e68a7bf6c150ad4e7f150 Mon Sep 17 00:00:00 2001 From: Jens Remus Date: Tue, 20 Feb 2018 10:22:41 +0100 Subject: [PATCH] lsluns: print a message if no adapter or port exists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Suggested-by: Benjamin Block Signed-off-by: Jens Remus Reviewed-by: Steffen Maier Signed-off-by: Jan Höppner --- CHANGELOG.md | 1 + zconf/lsluns | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1531370c..eed8badb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)__ diff --git a/zconf/lsluns b/zconf/lsluns index 9cf764dd..f88aa0f6 100755 --- a/zconf/lsluns +++ b/zconf/lsluns @@ -235,8 +235,15 @@ sub get_env_list my @res ; my %res_hash; + if (!) { + print "$PROGRAM_NAME: No adapter exists\n"; + return; + } @res = ; - 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];