lsluns: do not scan (all) if filters match nothing

Fix the following undesired behavior of lsluns to scan all resources if the
user provided filters did not match anything:

    No valid combination found for adapter '5080'. Removing from resource
    list.
No valid parameters left, using all available resources in system.
Scanning for LUNs on adapter 0.0.5080
...

Scanning can be resource consumptive. So if a user already wants to filter,
possibly to reduce resource consumption, he does not want to happen to scan
everything and thus consume the worst case of resources.

Instead print a message to inform the user why nothing was scanned.

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:35:43 +01:00
committed by Michael Holzheu
parent f0d8bc02a7
commit 398f9ceac8

View File

@@ -219,7 +219,6 @@ sub get_env_list
@res = </sys/bus/ccw/drivers/zfcp/*.*.*/0x*>;
return () if (!@res);
reload:
foreach my $entry (@res) {
my $a = ${[split('/', $entry)]}[-2];
my $p = ${[split('/', $entry)]}[-1];
@@ -243,12 +242,7 @@ reload:
}
if (!%res_hash) {
print "\nNo valid parameters left, ",
"using all available resources in system.\n\n";
@$a_ref_list = ();
@$p_ref_list = ();
@t_arr = ();
goto reload;
print "$PROGRAM_NAME: Adapter and/or port filter(s) did not match anything\n";
}
return %res_hash;
}