lsluns: do not print confusing messages when a filter matches nothing

lsluns printed potentially confusing messages when a filter or combination
of filters matched nothing:

    No valid combination found for adapter '0.0.1906'. Removing from
    resource list.
    No valid combination found for port '0x50050763071845e3'. Removing from
    resource list.
...

To the user it is potentially unclear which 'combination' is actually being
referred to, as only one part of the combination is mentioned, and what the
ominous 'resource list' is. The later information is merely useful for a
developer to debug the script.

Such a message was written for every user supplied filter that did not
contribute anything to the resulting subset that is being listed, although
the filter actually might match something when used standalone.

Additionally those messages were printed to stdout instead of stderr. As
there is no debug or verbose switch and the information level of those
messages is low, we may simply discard them.

Reported-by: Steffen Maier <maier@linux.vnet.ibm.com>
Signed-off-by: Jens Remus <jremus@linux.vnet.ibm.com>
Reviewed-by: Steffen Maier <maier@linux.vnet.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
This commit is contained in:
Jens Remus
2016-11-10 12:43:16 +01:00
committed by Michael Holzheu
parent 398f9ceac8
commit c993ad89c5
-15
View File
@@ -215,7 +215,6 @@ sub get_env_list
my $p_ref_list = shift();
my @res ;
my %res_hash;
my @t_arr;
@res = </sys/bus/ccw/drivers/zfcp/*.*.*/0x*>;
return () if (!@res);
@@ -226,20 +225,6 @@ sub get_env_list
next if (@$p_ref_list && "@$p_ref_list" !~ /$p/);
push @{ $res_hash{$a} }, $p;
}
foreach my $a (sort @$a_ref_list) {
if ("@{[keys %res_hash]}" !~ /$a/) {
print "\tNo valid combination found for adapter '$a'. ",
"Removing from resource list.\n";
}
}
push @t_arr, map { @{$res_hash{$_}} } keys %res_hash;
foreach my $p (@$p_ref_list) {
if ("@t_arr" !~ /$p/) {
print "\tNo valid combination found for port '$p'. ",
"Removing from resource list.\n";
}
}
if (!%res_hash) {
print "$PROGRAM_NAME: Adapter and/or port filter(s) did not match anything\n";