From d8bd3482e1ad644f98b80792908c7f319b89e0a9 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Wed, 24 Jan 2007 13:31:00 +0000 Subject: [PATCH] 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 git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@85 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scstadmin/scstadmin | 110 ++++++++++++++++++++++---------------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/scstadmin/scstadmin b/scstadmin/scstadmin index e4e1f9164..d125b3362 100755 --- a/scstadmin/scstadmin +++ b/scstadmin/scstadmin @@ -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) {