70 lines
2.8 KiB
Diff
70 lines
2.8 KiB
Diff
From bdc3b89850bb437f48cb2f9fa31a8f51d3cd88b5 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
|
|
Date: Fri, 28 Jan 2011 14:30:22 +0100
|
|
Subject: [PATCH 60/61] lsluns: Fix LUN reporting for SAN volume controller (SVC)
|
|
|
|
Description: lsluns: Fix LUN reporting for SAN volume controller (SVC)
|
|
Symptom: lsluns fails to report LUNs from SVC
|
|
Problem: The SCSI Architecture Model (SAM) specifies that a storage
|
|
server only has to support the REPORT LUNs command for LUN 0
|
|
or the "REPORT LUNS Well-Known-LUN" (WLUN). The SAN Volume
|
|
Controller (SVC) only supports REPORT LUNS on LUN 0. The
|
|
approach of lsluns of sending the REPORT LUNS to any attached
|
|
LUN does not work for the SVC.
|
|
Solution: Change the strategy of lsluns to check if the LUN 0 or the
|
|
WLUN is already available. If both LUNs are not available,
|
|
first try to attach LUN 0 and issue the command; if this
|
|
fails, try the WLUN.
|
|
---
|
|
zconf/lsluns | 14 +++++++++-----
|
|
1 files changed, 9 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/zconf/lsluns b/zconf/lsluns
|
|
index 769b846..acbdcd7 100755
|
|
--- a/zconf/lsluns
|
|
+++ b/zconf/lsluns
|
|
@@ -45,16 +45,16 @@ sub list_luns
|
|
next;
|
|
}
|
|
if (!defined($lun_hash{$a}{$p})) {
|
|
- `echo $wlun >> $drv_dir/$a/$p/unit_add 2>/dev/null`;
|
|
+ `echo $lun0 >> $drv_dir/$a/$p/unit_add 2>/dev/null`;
|
|
select(undef, undef, undef, 0.1);
|
|
%lun_hash = get_lun_hash();
|
|
if (!defined($lun_hash{$a}{$p})) {
|
|
- `echo $wlun >> $drv_dir/$a/$p/unit_remove 2>/dev/null`;
|
|
- `echo $lun0 >> $drv_dir/$a/$p/unit_add 2>/dev/null`;
|
|
+ `echo $lun0 >> $drv_dir/$a/$p/unit_remove 2>/dev/null`;
|
|
+ `echo $wlun >> $drv_dir/$a/$p/unit_add 2>/dev/null`;
|
|
select(undef, undef, undef, 0.1);
|
|
%lun_hash = get_lun_hash();
|
|
if (!defined($lun_hash{$a}{$p})) {
|
|
- `echo $lun0 >> $drv_dir/$a/$p/unit_remove 2>/dev/null`;
|
|
+ `echo $wlun >> $drv_dir/$a/$p/unit_remove 2>/dev/null`;
|
|
print"\tat port $p:\n";
|
|
print "\t\tCannot attach WLUN / LUN0 for scanning.\n";
|
|
next;
|
|
@@ -92,6 +92,8 @@ sub list_luns
|
|
}
|
|
}
|
|
|
|
+# Look only for LUN0 and the REPORT LUNs WLUN. SAM specifies that the storage
|
|
+# only has to response on one of those to the REPORT LUNs command.
|
|
sub get_lun_hash
|
|
{
|
|
my %lun_hash;
|
|
@@ -105,7 +107,9 @@ sub get_lun_hash
|
|
$p =~ s/(0x\w{16})*\n/$1/;
|
|
chomp($a);
|
|
|
|
- $lun_hash{$a}{$p}{$l} = ${[split('/', $device)]}[-1];
|
|
+ if ($l eq $lun0 or $l eq $wlun) {
|
|
+ $lun_hash{$a}{$p}{$l} = ${[split('/', $device)]}[-1];
|
|
+ }
|
|
}
|
|
return %lun_hash;
|
|
}
|
|
--
|
|
1.7.3.5
|
|
|