From: <mga...@us...> - 2010-11-15 15:55:45
|
Revision: 2710 http://scst.svn.sourceforge.net/scst/?rev=2710&view=rev Author: mgandalf Date: 2010-11-15 15:55:39 +0000 (Mon, 15 Nov 2010) Log Message: ----------- - Apply target attributes before assigning LUNs. - Always enable/disable targets and drivers last. Modified Paths: -------------- trunk/scstadmin/scstadmin.sysfs/scstadmin Modified: trunk/scstadmin/scstadmin.sysfs/scstadmin =================================================================== --- trunk/scstadmin/scstadmin.sysfs/scstadmin 2010-11-14 16:16:15 UTC (rev 2709) +++ trunk/scstadmin/scstadmin.sysfs/scstadmin 2010-11-15 15:55:39 UTC (rev 2710) @@ -1912,14 +1912,18 @@ } my %_attributes; + my %special; foreach my $item (keys %{$$assignments{$driver}}) { if ($item eq 'TARGET') { $changes += applyTargetAssignments($driver, $$assignments{$driver}->{$item}, $deletions); + } elsif ($item ne 'enabled') { + # Enable driver last + $_attributes{$item} = $$assignments{$driver}->{$item}; } else { - $_attributes{$item} = $$assignments{$driver}->{$item}; + $special{$item} = $$assignments{$driver}->{$item}; + } - } my $attributes = configToAttr(\%_attributes); @@ -1927,6 +1931,15 @@ if (scalar keys %{$attributes}) { $changes += setDriverAttributes($driver, $attributes, $deletions); } + + $attributes = configToAttr(\%special); + my $d_attributes = $SCST->driverAttributes($driver); + + if (defined($$d_attributes{'enabled'}) && + ($$d_attributes{'enabled'}->{'value'} != $$attributes{'enabled'})) { + setDriverAttribute($driver, 'enabled', $$attributes{'enabled'}); + $changes++; + } } return $changes; @@ -2051,21 +2064,38 @@ } } + # Apply attribute changes first in case we want a different address method applied my %_attributes; foreach my $item (keys %{$$targets{$target}}) { + # Handle enabled attribute last + next if (($item eq 'GROUP') || ($item eq 'LUN') || ($item eq 'enabled')); + $_attributes{$item} = $$targets{$target}->{$item}; + } + + my $attributes = configToAttr(\%_attributes); + filterCreateAttributes($possible, $attributes, TRUE); + $changes += setTargetAttributes($driver, $target, $attributes, $deletions); + + %_attributes = (); + foreach my $item (keys %{$$targets{$target}}) { if ($item eq 'GROUP') { $changes += applyGroupAssignments($driver, $target, $$targets{$target}->{$item}); $changes += applyInitiatorAssignments($driver, $target, $$targets{$target}->{$item}, $deletions); } elsif ($item eq 'LUN') { $changes += applyLunAssignments($driver, $target, undef, $$targets{$target}->{$item}); - } else { + } elsif ($item eq 'enabled') { $_attributes{$item} = $$targets{$target}->{$item}; } } - my $attributes = configToAttr(\%_attributes); - filterCreateAttributes($possible, $attributes, TRUE); - $changes += setTargetAttributes($driver, $target, $attributes, $deletions); + $attributes = configToAttr(\%_attributes); + my $t_attributes = $SCST->targetAttributes($driver, $target); + + if (defined($$t_attributes{'enabled'}) && + ($$t_attributes{'enabled'}->{'value'} != $$attributes{'enabled'})) { + setTargetAttribute($driver, $target, 'enabled', $$attributes{'enabled'}); + $changes++; + } } return $changes; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |