Here is a patch to the scstadmin script that solves my startup problems, when

initiator doesn't see the target and puts in the kernel log messages like that:

qla2300 0000:02:03.0: scsi(6:0:0): Abort command issued -- a 2002.
 6:0:0:0: scsi: Device offlined - not ready after error recovery
 6:0:0:0: rejecting I/O to offline device

All it does is move the enabling of target mode to the end of the
applyConfiguration subroutine. The key seems to be that target mode must
be enabled after SCST device and group assignments are configured. 

From Brad Johnson <bjohnson@proficientsolutionsinc.com>


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@85 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2007-01-24 13:31:00 +00:00
parent a0867f49fc
commit d8bd3482e1
+55 -55
View File
@@ -526,61 +526,6 @@ sub applyConfiguration {
print "Applying configurations additions..\n" if (!$check);
print "\n";
# Enable/Disable configured targets
foreach my $type (keys %{$$config{'TARGETS'}}) {
my $enable;
if ($type eq 'enable') {
$enable = $TRUE;
} elsif ($type eq 'disable') {
$enable = $FALSE;
} else {
print "\t-> WARNING: Ignoring invalid TARGETS specifier '$type'. ".
"Should be one of enable,disable.\n";
next;
}
foreach my $target (@{$$config{'TARGETS'}->{$type}->{'HOST'}}) {
my $i_target = unformatTarget($target);
if (!defined($$TARGETS{$i_target})) {
print "\t-> WARNING: Target '$target' not found on system.\n";
$errs += 1;
next;
}
next if ($enable == targetEnabled($i_target));
if (!$enable && targetEnabled($target)) {
if ($force || $check) {
print "\t-force: Target mode for '$target' is currently enabled, ".
"however configuration file wants it disabled";
if (!$check) {
print ", disabling.\n";
$errs += enableTarget($target, $enable);
} else {
print ".\n";
}
$changes++;
}
} else {
print "\t-> Target '$target' is enabled in configuration file, ".
"however is currently disabled";
if (!$check) {
print ", enabling.\n";
$errs += enableTarget($target, $enable);
} else {
print ".\n";
}
$changes++;
}
}
}
# Open new devices and assign them to handlers..
foreach my $entry (keys %{$$config{'HANDLER'}}) {
if (!$HANDLERS{$_HANDLER_MAP_{$entry}}) {
@@ -788,6 +733,61 @@ sub applyConfiguration {
}
}
# Enable/Disable configured targets
foreach my $type (keys %{$$config{'TARGETS'}}) {
my $enable;
if ($type eq 'enable') {
$enable = $TRUE;
} elsif ($type eq 'disable') {
$enable = $FALSE;
} else {
print "\t-> WARNING: Ignoring invalid TARGETS specifier '$type'. ".
"Should be one of enable,disable.\n";
next;
}
foreach my $target (@{$$config{'TARGETS'}->{$type}->{'HOST'}}) {
my $i_target = unformatTarget($target);
if (!defined($$TARGETS{$i_target})) {
print "\t-> WARNING: Target '$target' not found on system.\n";
$errs += 1;
next;
}
next if ($enable == targetEnabled($i_target));
if (!$enable && targetEnabled($target)) {
if ($force || $check) {
print "\t-force: Target mode for '$target' is currently enabled, ".
"however configuration file wants it disabled";
if (!$check) {
print ", disabling.\n";
$errs += enableTarget($target, $enable);
} else {
print ".\n";
}
$changes++;
}
} else {
print "\t-> Target '$target' is enabled in configuration file, ".
"however is currently disabled";
if (!$check) {
print ", enabling.\n";
$errs += enableTarget($target, $enable);
} else {
print ".\n";
}
$changes++;
}
}
}
print "\nEncountered $errs error(s) while processing.\n" if ($errs);
if ($check) {