From: <bva...@us...> - 2011-07-18 07:54:18
|
Revision: 3682 http://scst.svn.sourceforge.net/scst/?rev=3682&view=rev Author: bvassche Date: 2011-07-18 07:54:12 +0000 (Mon, 18 Jul 2011) Log Message: ----------- scstadmin: Make -write_config write out initiator names in alphabetical order Modified Paths: -------------- trunk/scstadmin/scstadmin.sysfs/scstadmin Modified: trunk/scstadmin/scstadmin.sysfs/scstadmin =================================================================== --- trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-07-18 07:49:05 UTC (rev 3681) +++ trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-07-18 07:54:12 UTC (rev 3682) @@ -1290,7 +1290,7 @@ my $inits = $CURRENT{'assign'}->{$driver}->{$target}->{'GROUP'}->{$group}->{'INITIATORS'}; my $init_buff; - foreach my $init (@{$inits}) { + foreach my $init (sort @{$inits}) { $init_buff .= "\n\t\t\tINITIATOR $init"; my $attributes = $SCST->initiatorAttributes($driver, $target, $group, $init); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bva...@us...> - 2011-07-18 08:56:12
|
Revision: 3683 http://scst.svn.sourceforge.net/scst/?rev=3683&view=rev Author: bvassche Date: 2011-07-18 08:56:06 +0000 (Mon, 18 Jul 2011) Log Message: ----------- scstadmin: Partially revert r3678. Checking whether a group name has been specified is the responsability of the Perl command line parser. Modified Paths: -------------- trunk/scstadmin/scstadmin.sysfs/scstadmin Modified: trunk/scstadmin/scstadmin.sysfs/scstadmin =================================================================== --- trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-07-18 07:54:12 UTC (rev 3682) +++ trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-07-18 08:56:06 UTC (rev 3683) @@ -425,8 +425,7 @@ exit 1; } - if (defined($listGroupAttr) && (($driver eq '') || ($target eq '') || - ($listGroupAttr eq ''))) { + if (defined($listGroupAttr) && ($driver eq '') || ($target eq '')) { print "Please specify -driver, -target and group with -list_grp_attr.\n"; exit 1; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bva...@us...> - 2011-07-18 09:13:18
|
Revision: 3684 http://scst.svn.sourceforge.net/scst/?rev=3684&view=rev Author: bvassche Date: 2011-07-18 09:13:12 +0000 (Mon, 18 Jul 2011) Log Message: ----------- scstadmin: Should have been included in r3683. Modified Paths: -------------- trunk/scstadmin/scstadmin.sysfs/scstadmin Modified: trunk/scstadmin/scstadmin.sysfs/scstadmin =================================================================== --- trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-07-18 08:56:06 UTC (rev 3683) +++ trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-07-18 09:13:12 UTC (rev 3684) @@ -425,7 +425,7 @@ exit 1; } - if (defined($listGroupAttr) && ($driver eq '') || ($target eq '')) { + if (defined($listGroupAttr) && (($driver eq '') || ($target eq ''))) { print "Please specify -driver, -target and group with -list_grp_attr.\n"; exit 1; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bva...@us...> - 2011-07-18 10:00:19
|
Revision: 3685 http://scst.svn.sourceforge.net/scst/?rev=3685&view=rev Author: bvassche Date: 2011-07-18 10:00:13 +0000 (Mon, 18 Jul 2011) Log Message: ----------- scstadmin: When adding a target attribute, report that a target attribute is being added instead of a driver attribute. Modified Paths: -------------- trunk/scstadmin/scstadmin.sysfs/scstadmin Modified: trunk/scstadmin/scstadmin.sysfs/scstadmin =================================================================== --- trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-07-18 09:13:12 UTC (rev 3684) +++ trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-07-18 10:00:13 UTC (rev 3685) @@ -3540,7 +3540,7 @@ my $attribute = shift; my $value = shift; - print "\t-> Adding driver attribute '$attribute' with value '$value' ". + print "\t-> Adding target attribute '$attribute' with value '$value' ". "for driver/target '$driver/$target': "; my $rc = $SCST->addTargetDynamicAttribute($driver, $target, $attribute, $value); print "done.\n"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bva...@us...> - 2011-07-18 10:37:37
|
Revision: 3686 http://scst.svn.sourceforge.net/scst/?rev=3686&view=rev Author: bvassche Date: 2011-07-18 10:37:31 +0000 (Mon, 18 Jul 2011) Log Message: ----------- scstadmin: Change help text wording. Modified Paths: -------------- trunk/scstadmin/scstadmin.sysfs/scstadmin Modified: trunk/scstadmin/scstadmin.sysfs/scstadmin =================================================================== --- trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-07-18 10:00:13 UTC (rev 3685) +++ trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-07-18 10:37:31 UTC (rev 3686) @@ -80,16 +80,16 @@ -attributes <p=v,...> Add Dynamic Attribute Operations - -add_drv_attr <driver> : Adds driver attribute(s) <p> to value <v>. + -add_drv_attr <driver> : Adds driver attribute(s) <p> with value <v>. -attributes <p=v,...> - -add_tgt_attr <target> : Adds target attribute(s) <p> to value <v>. + -add_tgt_attr <target> : Adds target attribute(s) <p> with value <v>. -driver <driver> -attributes <p=v,...> Remove Dynamic Attribute Operations - -rem_drv_attr <driver> : Remove driver attribute(s) <p> to value <v>. + -rem_drv_attr <driver> : Remove driver attribute(s) <p> with value <v>. -attributes <p=v,...> - -rem_tgt_attr <target> : Remove target attribute(s) <p> to value <v>. + -rem_tgt_attr <target> : Remove target attribute(s) <p> with value <v>. -driver <driver> -attributes <p=v,...> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bva...@us...> - 2011-07-18 11:54:09
|
Revision: 3687 http://scst.svn.sourceforge.net/scst/?rev=3687&view=rev Author: bvassche Date: 2011-07-18 11:54:02 +0000 (Mon, 18 Jul 2011) Log Message: ----------- scstadmin: Make clear that the initiator group argument is optional for the LUN manipulation commands. Modified Paths: -------------- trunk/scstadmin/scstadmin.sysfs/scstadmin Modified: trunk/scstadmin/scstadmin.sysfs/scstadmin =================================================================== --- trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-07-18 10:37:31 UTC (rev 3686) +++ trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-07-18 11:54:02 UTC (rev 3687) @@ -138,23 +138,23 @@ -add_lun <lun> : Adds a given device to a group. -driver <driver> -target <target> - -group <group> + [-group <group>] -device <device> -attributes <p=v,...> -rem_lun <lun> : Remove a LUN from a group. -driver <driver> -target <target> - -group <group> + [-group <group>] -replace_lun <lun> : Replaces a LUN\'s device with a different one. -driver <driver> -target <target> - -group <group> + [-group <group>] -device <device> -attributes <p=v,...> -clear_luns : Clear all LUNs within a group. -driver <driver> -target <target> - -group <group> + [-group <group>] Target Driver Operations -enable_target <t> : Enable target mode for a given driver & target. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mga...@us...> - 2011-07-25 19:19:20
|
Revision: 3754 http://scst.svn.sourceforge.net/scst/?rev=3754&view=rev Author: mgandalf Date: 2011-07-25 19:19:14 +0000 (Mon, 25 Jul 2011) Log Message: ----------- - Read current ALUA configuration. - Write current ALUA configuration. Modified Paths: -------------- trunk/scstadmin/scstadmin.sysfs/scstadmin Modified: trunk/scstadmin/scstadmin.sysfs/scstadmin =================================================================== --- trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-07-25 18:25:48 UTC (rev 3753) +++ trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-07-25 19:19:14 UTC (rev 3754) @@ -1202,6 +1202,20 @@ } } + my $dgroups = $SCST->deviceGroups(); + immediateExit($SCST->errorString()); + + foreach my $dgroup (@{$dgroups}) { + $CURRENT{'dgroups'}->{$dgroup}->{'devices'} = $SCST->deviceGroupDevices($dgroup); + immediateExit($SCST->errorString()); + my $tgroups = $SCST->targetGroups($dgroup); + immediateExit($SCST->errorString()); + foreach my $tgroup (@{$tgroups}) { + $CURRENT{'dgroups'}->{$dgroup}->{'tgroups'}->{$tgroup}->{'inits'} = + $SCST->targetGroupInitiators($dgroup, $tgroup); + } + } + print "done.\n\n"; # Perform some basic checks @@ -1230,6 +1244,9 @@ } } +use Data::Dumper; +print Dumper(\%CURRENT); + return FALSE; } @@ -1614,6 +1631,97 @@ } } + foreach my $dgroup (sort keys %{$CURRENT{'dgroups'}}) { + my $dgroup_buff; + + my $dgroup_attrs = $SCST->deviceGroupAttributes($dgroup); + + my $dgrp_attr_buff; + my $dgrp_attr_buff_nk; + + $dgrp_attr_buff = serializeKeyAttr("\t", $dgroup_attrs); + $dgrp_attr_buff_nk = serializeNkAttr("\t", $dgroup_attrs) if ($nonkey); + $dgrp_attr_buff .= "\n" if ($dgrp_attr_buff); + $dgrp_attr_buff_nk .= "\n" if ($dgrp_attr_buff_nk); + + my $tgroups = $CURRENT{'dgroups'}->{$dgroup}->{'tgroups'}; + + my $tgroup_buff; + + foreach my $tgroup (sort keys %{$tgroups}) { + $tgroup_buff .= "\tTARGET_GROUP $tgroup"; + + my $attributes = $SCST->targetGroupAttributes($dgroup, $tgroup); + + my $attribute_buff; + my $attribute_buff_nk; + + $attribute_buff .= serializeKeyAttr("\t\t", $attributes); + $attribute_buff_nk .= serializeNkAttr("\t\t", $attributes) if ($nonkey); + $attribute_buff .= "\n" if ($attribute_buff); + $attribute_buff_nk .= "\n" if ($attribute_buff_nk); + + my $inits = $CURRENT{'dgroups'}->{$dgroup}->{'tgroups'}->{$tgroup}->{'inits'}; + + my $init_buff; + foreach my $init (@{$inits}) { + $init_buff .= "\t\tINITIATOR $init"; + + my $ini_attrs = $SCST->targetGroupInitiatorAttributes($dgroup, $tgroup, $init); + + my $i_attribute_buff + = serializeKeyAttr("\t\t\t", $ini_attrs); + my $i_attribute_buff_nk + = serializeNkAttr("\t\t\t", $ini_attrs) if ($nonkey); + + if ($i_attribute_buff_nk) { + $i_attribute_buff .= "\t\t\t# Non-key attributes\n"; + $i_attribute_buff .= $i_attribute_buff_nk; + } + + if ($i_attribute_buff) { + $init_buff .= " {\n"; + $init_buff .= $i_attribute_buff; + $init_buff .= "\t\t}\n"; + } else { + $init_buff .= "\n"; + } + } + + if ($attribute_buff_nk) { + $attribute_buff .= "\t\t# Non-key attributes\n"; + $attribute_buff .= $attribute_buff_nk; + } + + if ($attribute_buff || $init_buff) { + $tgroup_buff .= " {\n"; + + $tgroup_buff .= $attribute_buff; + $tgroup_buff .= $init_buff; + + $tgroup_buff =~ s/\n\n$/\n/; + $tgroup_buff .= "\t}\n\n"; + } else { + $tgroup_buff .= "\n"; + } + } + + if ($dgrp_attr_buff_nk) { + $dgrp_attr_buff .= "\t# Non-key attributes\n"; + $dgrp_attr_buff .= $dgrp_attr_buff_nk; + } + + $dgroup_buff .= $dgrp_attr_buff; + $dgroup_buff .= $tgroup_buff; + $dgroup_buff =~ s/\n\n$/\n/; + + if ($dgroup_buff) { + print $io "DEVICE_GROUP $dgroup {\n"; + print $io $dgroup_buff; + print $io "}\n\n"; + } + } + close $io; return 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mga...@us...> - 2011-07-25 19:22:02
|
Revision: 3755 http://scst.svn.sourceforge.net/scst/?rev=3755&view=rev Author: mgandalf Date: 2011-07-25 19:21:55 +0000 (Mon, 25 Jul 2011) Log Message: ----------- - Remove some left over debugging. Modified Paths: -------------- trunk/scstadmin/scstadmin.sysfs/scstadmin Modified: trunk/scstadmin/scstadmin.sysfs/scstadmin =================================================================== --- trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-07-25 19:19:14 UTC (rev 3754) +++ trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-07-25 19:21:55 UTC (rev 3755) @@ -1244,9 +1244,6 @@ } } -use Data::Dumper; -print Dumper(\%CURRENT); - return FALSE; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mga...@us...> - 2011-07-25 20:11:27
|
Revision: 3756 http://scst.svn.sourceforge.net/scst/?rev=3756&view=rev Author: mgandalf Date: 2011-07-25 20:11:21 +0000 (Mon, 25 Jul 2011) Log Message: ----------- - Ignore the new DEVICE_GROUP clause when applying SCST attributes. Modified Paths: -------------- trunk/scstadmin/scstadmin.sysfs/scstadmin Modified: trunk/scstadmin/scstadmin.sysfs/scstadmin =================================================================== --- trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-07-25 19:21:55 UTC (rev 3755) +++ trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-07-25 20:11:21 UTC (rev 3756) @@ -1922,6 +1922,7 @@ foreach my $item (keys %{$CONFIG}) { next if ($item eq 'HANDLER'); next if ($item eq 'TARGET_DRIVER'); + next if ($item eq 'DEVICE_GROUP'); $_attributes{$item} = $$CONFIG{$item}; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mga...@us...> - 2011-07-26 16:47:55
|
Revision: 3765 http://scst.svn.sourceforge.net/scst/?rev=3765&view=rev Author: mgandalf Date: 2011-07-26 16:47:49 +0000 (Tue, 26 Jul 2011) Log Message: ----------- - Finish writeConfiguration(). - Added clearConfiguration() support for ALUA. - Added applyConfiguration() support for ALUA. At this point, ALUA support should be complete. Todo: Rewrite and simplify a whole lot of redundant code. Modified Paths: -------------- trunk/scstadmin/scstadmin.sysfs/scstadmin Modified: trunk/scstadmin/scstadmin.sysfs/scstadmin =================================================================== --- trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-07-26 13:51:10 UTC (rev 3764) +++ trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-07-26 16:47:49 UTC (rev 3765) @@ -1641,6 +1641,16 @@ $dgrp_attr_buff .= "\n" if ($dgrp_attr_buff); $dgrp_attr_buff_nk .= "\n" if ($dgrp_attr_buff_nk); + my $devices_buff; + + my $devices = $CURRENT{'dgroups'}->{$dgroup}->{'devices'}; + + foreach my $device (@{$devices}) { + $devices_buff .= "\tDEVICE $device\n"; + } + + $devices_buff .= "\n" if ($devices_buff); + my $tgroups = $CURRENT{'dgroups'}->{$dgroup}->{'tgroups'}; my $tgroup_buff; @@ -1709,6 +1719,7 @@ } $dgroup_buff .= $dgrp_attr_buff; + $dgroup_buff .= $devices_buff; $dgroup_buff .= $tgroup_buff; $dgroup_buff =~ s/\n\n$/\n/; @@ -1888,6 +1899,17 @@ } } + foreach my $dgroup (keys %{$$CONFIG{'DEVICE_GROUP'}}) { + foreach my $device (keys %{$$CONFIG{'DEVICE_GROUP'}->{$dgroup}->{'DEVICE'}}) { + if (!defined($cdevices{$device})) { + print "\t-> WARNING: Device '$device' associated with device group '$dgroup' ". + "is not defined within configuration, removing it.\n\n"; + delete $$CONFIG{'DEVICE_GROUP'}->{$dgroup}->{'DEVICE'}->{$device}; + $warnings++; + } + } + } + if ($errors) { print "\t-> Done, $errors errors found.\n"; return TRUE; @@ -1916,6 +1938,7 @@ # Apply config additions $changes += applyConfigDevices($CONFIG, $force); $changes += applyConfigAssignments($CONFIG, $force); + $changes += applyConfigDeviceGroups($CONFIG, $force); # And SCST attributes.. my %_attributes; @@ -2182,6 +2205,103 @@ return $changes; } +sub applyConfigDeviceGroups { + my $config = shift; + my $deletions = shift; + my $changes = 0; + + my $dgroups = $CURRENT{'dgroups'}; + + foreach my $dgroup (keys %{$dgroups}) { + if (!defined($$config{'DEVICE_GROUP'}->{$dgroup})) { + if ($deletions) { + removeDeviceGroup($dgroup, TRUE); + $changes++; + } else { + print "\t-> Device Group '$dgroup' is not in configuration. Use -force to remove.\n"; + } + } else { + my $devices = $CURRENT{'dgroups'}->{$dgroup}->{'devices'}; + + foreach my $device (@{$devices}) { + if (!defined($$config{'DEVICE_GROUP'}->{$dgroup}->{'DEVICE'}->{$device})) { + if ($deletions) { + removeDeviceGroupDevice($dgroup, $device); + $changes++; + } else { + print "\t-> Device '$device' within device group '$dgroup' is not in configuration. Use -force to remove.\n"; + } + } + } + + foreach my $tgroup (keys %{$$dgroups{$dgroup}->{'tgroups'}}) { + if (!defined($$config{'DEVICE_GROUP'}->{$dgroup}->{'TARGET_GROUP'}->{$tgroup})) { + if ($deletions) { + removeTargetGroup($dgroup, $tgroup, TRUE); + $changes++; + } else { + print "\t-> Target Group '$dgroup/$tgroup' is not in configuration. Use -force to remove.\n"; + } + } + } + } + } + + $dgroups = $$config{'DEVICE_GROUP'}; + + foreach my $dgroup (sort keys %{$dgroups}) { + if (!defined($CURRENT{'dgroups'}->{$dgroup})) { + addDeviceGroup($dgroup); + $changes++; + } + + my $devices = $$dgroups{$dgroup}->{'DEVICE'}; + + foreach my $device (sort keys %{$devices}) { + if (!deviceGroupHasDevice($dgroup, $device)) { + addDeviceGroupDevice($dgroup, $device); + $changes++; + } + } + + my $tgroups = $$dgroups{$dgroup}->{'TARGET_GROUP'}; + + foreach my $tgroup (sort keys %{$tgroups}) { + if (!defined($CURRENT{'dgroups'}->{$dgroup}->{'tgroups'}->{$tgroup})) { + addTargetGroup($dgroup, $tgroup); + $changes++; + } + + my %_attributes; + foreach my $item (keys %{$$tgroups{$tgroup}}) { + next if ($item eq 'INITIATOR'); + $_attributes{$item} = $$tgroups{$tgroup}->{$item}; + } + + my $attributes = configToAttr(\%_attributes); + + if (scalar keys %{$attributes}) { + $changes += setTargetGroupAttributes($dgroup, $tgroup, $attributes); + } + } + + my %_attributes; + foreach my $item (keys %{$$dgroups{$dgroup}}) { + next if ($item eq 'TARGET_GROUP'); + next if ($item eq 'DEVICE'); + $_attributes{$item} = $$dgroups{$dgroup}->{$item}; + } + + my $attributes = configToAttr(\%_attributes); + + if (scalar keys %{$attributes}) { + $changes += setDeviceGroupAttributes($dgroup, $attributes); + } + } + + return $changes; +} + sub applyInitiatorAssignments { my $driver = shift; my $target = shift; @@ -2442,10 +2562,23 @@ } sub clearConfiguration { + my $dgroups = $CURRENT{'dgroups'}; my $assignments = $CURRENT{'assign'}; print "-> Clearing running configuration.\n"; + foreach my $dgroup (sort keys %{$dgroups}) { + foreach my $tgroup (sort keys %{$$dgroups{$dgroup}->{'tgroups'}}) { + removeTargetGroup($dgroup, $tgroup, TRUE); + } + + foreach my $device (@{$$dgroups{$dgroup}->{'devices'}}) { + removeDeviceGroupDevice($dgroup, $device, TRUE); + } + + removeDeviceGroup($dgroup, TRUE); + } + foreach my $driver (sort keys %{$assignments}) { foreach my $target (sort keys %{$$assignments{$driver}}) { foreach my $group (sort keys %{$$assignments{$driver}->{$target}->{'GROUP'}}) { @@ -5254,6 +5387,19 @@ return FALSE; } +sub deviceGroupHasDevice { + my $group = shift; + my $device = shift; + + return FALSE if (!defined($CURRENT{'dgroups'}->{$group})); + + foreach my $_device (@{$CURRENT{'dgroups'}->{$group}->{'devices'}}) { + return TRUE if ($_device eq $device); + } + + return FALSE; +} + sub groupHasInitiator { my $initiators = shift; my $initiator = shift; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mga...@us...> - 2011-07-26 17:03:22
|
Revision: 3766 http://scst.svn.sourceforge.net/scst/?rev=3766&view=rev Author: mgandalf Date: 2011-07-26 17:03:15 +0000 (Tue, 26 Jul 2011) Log Message: ----------- - Forgot initiators within target groups. ALUA should be complete now. Modified Paths: -------------- trunk/scstadmin/scstadmin.sysfs/scstadmin Modified: trunk/scstadmin/scstadmin.sysfs/scstadmin =================================================================== --- trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-07-26 16:47:49 UTC (rev 3765) +++ trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-07-26 17:03:15 UTC (rev 3766) @@ -2242,6 +2242,19 @@ } else { print "\t-> Target Group '$dgroup/$tgroup' is not in configuration. Use -force to remove.\n"; } + } else { + my $inits = $$dgroups{$dgroup}->{'tgroups'}->{$tgroup}->{'inits'}; + + foreach my $init (@{$inits}) { + if (!defined($$config{'DEVICE_GROUP'}->{$dgroup}->{'TARGET_GROUP'}->{$tgroup}->{'INITIATOR'}->{$init})) { + if ($deletions) { + removeTargetGroupInitiator($dgroup, $tgroup, $init); + $changes++; + } else { + print "\t-> Initiator '$dgroup/$tgroup/$init' is not in configuration. Use -force to remove.\n"; + } + } + } } } } @@ -2272,6 +2285,26 @@ $changes++; } + my $inits = $$tgroups{$tgroup}->{'INITIATOR'}; + + foreach my $init (keys %{$inits}) { + if (!groupHasInitiator($CURRENT{'dgroups'}->{$dgroup}->{'tgroups'}->{$tgroup}->{'inits'}, $init)) { + addTargetGroupInitiator($dgroup, $tgroup, $init); + $changes++; + } + + my %_attributes; + foreach my $item (keys %{$$inits{$init}}) { + $_attributes{$item} = $$inits{$init}->{$item}; + } + + my $attributes = configToAttr(\%_attributes); + + if (scalar keys %{$attributes}) { + $changes += setTargetGroupInitiatorAttributes($dgroup, $tgroup, $init, $attributes); + } + } + my %_attributes; foreach my $item (keys %{$$tgroups{$tgroup}}) { next if ($item eq 'INITIATOR'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mga...@us...> - 2011-07-26 17:03:48
|
Revision: 3767 http://scst.svn.sourceforge.net/scst/?rev=3767&view=rev Author: mgandalf Date: 2011-07-26 17:03:42 +0000 (Tue, 26 Jul 2011) Log Message: ----------- - Sync version with scst. Modified Paths: -------------- trunk/scstadmin/scstadmin.sysfs/scstadmin Modified: trunk/scstadmin/scstadmin.sysfs/scstadmin =================================================================== --- trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-07-26 17:03:15 UTC (rev 3766) +++ trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-07-26 17:03:42 UTC (rev 3767) @@ -1,6 +1,6 @@ #!/usr/bin/perl -$Version = 'SCST Configurator v3.0.0-pre0'; +$Version = 'SCST Configurator v3.0.0-pre1'; # Configures SCST # This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mga...@us...> - 2011-07-26 18:28:43
|
Revision: 3771 http://scst.svn.sourceforge.net/scst/?rev=3771&view=rev Author: mgandalf Date: 2011-07-26 18:28:37 +0000 (Tue, 26 Jul 2011) Log Message: ----------- - Hopefully the last fix for initiator to target. Modified Paths: -------------- trunk/scstadmin/scstadmin.sysfs/scstadmin Modified: trunk/scstadmin/scstadmin.sysfs/scstadmin =================================================================== --- trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-07-26 18:26:57 UTC (rev 3770) +++ trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-07-26 18:28:37 UTC (rev 3771) @@ -132,7 +132,7 @@ -tgt_group <tgrp> : Add target group <tgrp> to device group <dgrp>. -rem_tgrp <tgrp> -dev_group <dgrp> : Remove target group <tgrp> from device group. - -add_tgrp_init <init> : Add target to specified target group. + -add_tgrp_tgt <tgt> : Add target to specified target group. -dev_group <dgrp> -tgt_group <tgrp> -rem_tgrp_tgt <tgt> : Remove target from specified target group. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mga...@us...> - 2011-07-26 18:39:20
|
Revision: 3774 http://scst.svn.sourceforge.net/scst/?rev=3774&view=rev Author: mgandalf Date: 2011-07-26 18:39:14 +0000 (Tue, 26 Jul 2011) Log Message: ----------- - Help menu cleanup. Modified Paths: -------------- trunk/scstadmin/scstadmin.sysfs/scstadmin Modified: trunk/scstadmin/scstadmin.sysfs/scstadmin =================================================================== --- trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-07-26 18:33:20 UTC (rev 3773) +++ trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-07-26 18:39:14 UTC (rev 3774) @@ -132,10 +132,10 @@ -tgt_group <tgrp> : Add target group <tgrp> to device group <dgrp>. -rem_tgrp <tgrp> -dev_group <dgrp> : Remove target group <tgrp> from device group. - -add_tgrp_tgt <tgt> : Add target to specified target group. + -add_tgrp_tgt <tgt> : Add target <tgt> to specified target group. -dev_group <dgrp> -tgt_group <tgrp> - -rem_tgrp_tgt <tgt> : Remove target from specified target group. + -rem_tgrp_tgt <tgt> : Remove target <tgt> from specified target group. -dev_group <dgrp> -tgt_group <tgrp> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mga...@us...> - 2011-11-11 17:50:14
|
Revision: 3918 http://scst.svn.sourceforge.net/scst/?rev=3918&view=rev Author: mgandalf Date: 2011-11-11 17:50:08 +0000 (Fri, 11 Nov 2011) Log Message: ----------- Fixed minor config file bug pointed out by Bart Van Assche. Modified Paths: -------------- trunk/scstadmin/scstadmin.sysfs/scstadmin Modified: trunk/scstadmin/scstadmin.sysfs/scstadmin =================================================================== --- trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-11-09 02:47:23 UTC (rev 3917) +++ trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-11-11 17:50:08 UTC (rev 3918) @@ -5052,8 +5052,8 @@ if (!$io); while (my $line = <$io>) { - my($test, undef) = split(/\#/, $line, 2); - if ($test =~ /\[(.*)\s+.*\]/) { + ($line, undef) = split(/\#/, $line, 2); + if ($line =~ /\[(.*)\s+.*\]/) { my $parm = $1; if (($parm eq 'HANDLER') || ($parm eq 'GROUP') || @@ -5118,7 +5118,6 @@ my $hash = shift; my $child = shift; - ($line, undef) = split(/\#/, $line, 2); return if ($line =~ /^\s*$/); $line =~ s/^\s+//; $line =~ s/\s+$//; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mga...@us...> - 2011-11-18 20:32:07
|
Revision: 3934 http://scst.svn.sourceforge.net/scst/?rev=3934&view=rev Author: mgandalf Date: 2011-11-18 20:32:01 +0000 (Fri, 18 Nov 2011) Log Message: ----------- - Fix -issue_lip as reported by Iain Paton. Modified Paths: -------------- trunk/scstadmin/scstadmin.sysfs/scstadmin Modified: trunk/scstadmin/scstadmin.sysfs/scstadmin =================================================================== --- trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-11-17 17:55:22 UTC (rev 3933) +++ trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-11-18 20:32:01 UTC (rev 3934) @@ -4994,44 +4994,43 @@ my $attributes = $SCST->targetAttributes($driver, $target); if (!defined($$attributes{'host'})) { - #print "\t-> Driver/target '$driver/$target' has no 'host' attribute, ignoring.\n"; + print "\t-> Driver/target '$driver/$target' has no 'host' attribute, ignoring.\n"; return FALSE; } my $dir = new IO::Handle; - if (!(opendir $dir, $$attributes{'host'}->{'value'}.'/device/fc_host')) { - #print "\t-> Driver/target is not a fibre channel target, ignoring.\n"; + my $host = $$attributes{'host'}->{'value'}; + my $ldir = $SCST->SCST_TARGETS_DIR."/$driver/$target/host/device/fc_host:$host"; + + if (!(opendir $dir, $ldir)) { + print "\t-> Driver/target is not a fibre channel target, ignoring.\n"; return FALSE; } - foreach my $host (readdir($dir)) { - next if (($host eq '.') || ($host eq '..')); + my $lip = $ldir.'/issue_lip'; - my $lip = $$attributes{'host'}->{'value'}.'/device/fc_host/'.$host.'/issue_lip'; + if (-w $lip) { + my $io = new IO::File $lip, O_WRONLY; - if (-w $lip) { - my $io = new IO::File $lip, O_WRONLY; + print "WARNING: Failed to open file '$lip' for writing.\n" + if (!$io); - print "WARNING: Failed to open file '$lip' for writing.\n" - if (!$io); + print "\t-> Issuing LIP on fibre channel driver/target '$driver/$target' ($host): "; - print "\t-> Issuing LIP on fibre channel driver/target '$driver/$target' ($host): "; + my $bytes = syswrite($io, 1, 1); - my $bytes = syswrite($io, 1, 1); + print "done.\n"; - print "done.\n"; - - if (!$bytes) { - print "WARNING: Failed to issue LIP on driver/target '$driver/$target'.\n"; - $rc = TRUE; - } - - close $io; - } else { - #print "Fibre channel driver/target '$driver/$target' lacks the ability to ". - # "issue LIPs, ignoring.\n"; + if (!$bytes) { + print "WARNING: Failed to issue LIP on driver/target '$driver/$target'.\n"; + $rc = TRUE; } + + close $io; + } else { + print "Fibre channel driver/target '$driver/$target' lacks the ability to ". + "issue LIPs, ignoring.\n"; } close $dir; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mga...@us...> - 2011-12-05 19:40:05
|
Revision: 3951 http://scst.svn.sourceforge.net/scst/?rev=3951&view=rev Author: mgandalf Date: 2011-12-05 19:39:59 +0000 (Mon, 05 Dec 2011) Log Message: ----------- - Warn only in issueLip() when -issue_lip is an argument. Modified Paths: -------------- trunk/scstadmin/scstadmin.sysfs/scstadmin Modified: trunk/scstadmin/scstadmin.sysfs/scstadmin =================================================================== --- trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-12-02 02:46:33 UTC (rev 3950) +++ trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-12-05 19:39:59 UTC (rev 3951) @@ -1134,7 +1134,7 @@ }; defined($issueLip) && do { print "\n-> Making requested changes.\n"; - $rc = issueLip($driver, $issueLip); + $rc = issueLip($driver, $issueLip, TRUE); print "\t-> Done.\n"; last SWITCH; }; @@ -4966,9 +4966,10 @@ sub issueLip { my $driver = shift; my $target = shift; + my $warn = shift; if (defined($driver) && defined($target)) { - return _issueLip($driver, $target); + return _issueLip($driver, $target, $warn); } else { my $drivers = $SCST->drivers(); @@ -4976,7 +4977,7 @@ my $targets = $SCST->targets($driver); foreach my $target (@{$targets}) { - my $rc = _issueLip($driver, $target); + my $rc = _issueLip($driver, $target, $warn); return $rc if ($rc); } @@ -4989,11 +4990,12 @@ sub _issueLip { my $driver = shift; my $target = shift; + my $warn = shift; my $rc = FALSE; my $attributes = $SCST->targetAttributes($driver, $target); - if (!defined($$attributes{'host'})) { + if (!defined($$attributes{'host'}) && $warn) { print "\t-> Driver/target '$driver/$target' has no 'host' attribute, ignoring.\n"; return FALSE; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mga...@us...> - 2011-12-06 19:41:39
|
Revision: 3956 http://scst.svn.sourceforge.net/scst/?rev=3956&view=rev Author: mgandalf Date: 2011-12-06 19:41:33 +0000 (Tue, 06 Dec 2011) Log Message: ----------- - Small directory check in _issueLip(). Not sure why this is needed. Modified Paths: -------------- trunk/scstadmin/scstadmin.sysfs/scstadmin Modified: trunk/scstadmin/scstadmin.sysfs/scstadmin =================================================================== --- trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-12-06 19:30:21 UTC (rev 3955) +++ trunk/scstadmin/scstadmin.sysfs/scstadmin 2011-12-06 19:41:33 UTC (rev 3956) @@ -5006,8 +5006,11 @@ my $ldir = $SCST->SCST_TARGETS_DIR."/$driver/$target/host/device/fc_host:$host"; if (!(opendir $dir, $ldir)) { - print "\t-> Driver/target is not a fibre channel target, ignoring.\n"; - return FALSE; + $ldir = $SCST->SCST_TARGETS_DIR."/$driver/$target/host/device/fc_host/$host"; + if (!(opendir $dir, $ldir)) { + print "\t-> Driver/target is not a fibre channel target, ignoring.\n"; + return FALSE; + } } my $lip = $ldir.'/issue_lip'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bva...@us...> - 2012-05-17 15:09:08
|
Revision: 4306 http://scst.svn.sourceforge.net/scst/?rev=4306&view=rev Author: bvassche Date: 2012-05-17 15:08:57 +0000 (Thu, 17 May 2012) Log Message: ----------- scstadmin, FC, NPIV: Make -write_config save the "node_name" and "parent_host" attributes. Reported-by: Dimitri Puzin <ma...@ps...> Modified Paths: -------------- trunk/scstadmin/scstadmin.sysfs/scstadmin Modified: trunk/scstadmin/scstadmin.sysfs/scstadmin =================================================================== --- trunk/scstadmin/scstadmin.sysfs/scstadmin 2012-05-17 12:54:42 UTC (rev 4305) +++ trunk/scstadmin/scstadmin.sysfs/scstadmin 2012-05-17 15:08:57 UTC (rev 4306) @@ -1442,8 +1442,8 @@ $attribute_buff = "\t\tHW_TARGET\n\n"; } - $attribute_buff .= serializeKeyAttr("\t\t", $attributes); - $attribute_buff_nk .= serializeNkAttr("\t\t", $attributes) if ($nonkey); + $attribute_buff .= serializeKeyAttr("\t\t", $attributes, $tgt_attrs); + $attribute_buff_nk .= serializeNkAttr("\t\t", $attributes, $tgt_attrs) if ($nonkey); $attribute_buff .= "\n" if ($attribute_buff); $attribute_buff_nk .= "\n" if ($attribute_buff_nk); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bva...@us...> - 2012-06-29 13:43:42
|
Revision: 4391 http://scst.svn.sourceforge.net/scst/?rev=4391&view=rev Author: bvassche Date: 2012-06-29 13:43:36 +0000 (Fri, 29 Jun 2012) Log Message: ----------- scstadmin: Allow hash signs to be escaped Hash signs have to be specified in scst.conf when using the per_portal_acl=1 feature of iSCSI-SCST in combination with LUN masking. Make scstadmin not consider hash signs preceded by a backslash as the start of a comment. Escape backslashes and hash signs when writing out scst.conf. Modified Paths: -------------- trunk/scstadmin/scstadmin.sysfs/scstadmin Modified: trunk/scstadmin/scstadmin.sysfs/scstadmin =================================================================== --- trunk/scstadmin/scstadmin.sysfs/scstadmin 2012-06-29 06:25:16 UTC (rev 4390) +++ trunk/scstadmin/scstadmin.sysfs/scstadmin 2012-06-29 13:43:36 UTC (rev 4391) @@ -1247,6 +1247,17 @@ return FALSE; } +# Escape metacharacters (space, backslash and hash sign). +sub escapeMeta { + my $value = shift; + + $value =~ s/([\\\#])/\\\1/g; + if ($value =~ / /) { + $value = "\"$value\""; + } + return $value; +} + # Serialize key attributes. # $prefix: output prefix, e.g. "\t\t". # $attributes: reference to a hash with attributes and their values. @@ -1269,10 +1280,7 @@ my $value = $$attributes{$attribute}->{'keys'}->{$key}->{'value'}; if ($value ne '') { - if ($value =~ / /) { - $value = "\"$value\""; - } - $result .= "$prefix$attribute $value\n"; + $result .= "$prefix$attribute " . escapeMeta($value) . "\n"; } } } elsif ($attribute eq 'enabled' || $attribute eq 'hw_target') { @@ -1305,10 +1313,7 @@ && $attribute ne 'hw_target') { my $value = $$attributes{$attribute}->{'value'}; if ($value ne '') { - if ($value =~ / /) { - $value = "\"$value\""; - } - $result .= "$prefix$attribute $value\n"; + $result .= "$prefix$attribute " . escapeMeta($value) . "\n"; } } } @@ -5056,7 +5061,8 @@ if (!$io); while (my $line = <$io>) { - ($line, undef) = split(/\#/, $line, 2); + $line =~ s/^\#.*//; + $line =~ s/[^\\]\#.*//; if ($line =~ /\[(.*)\s+.*\]/) { my $parm = $1; @@ -5069,6 +5075,7 @@ } } + $line =~ s/\\(.)/\1/g; $buffer .= $line; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mga...@us...> - 2012-08-27 14:39:05
|
Revision: 4474 http://scst.svn.sourceforge.net/scst/?rev=4474&view=rev Author: mgandalf Date: 2012-08-27 14:38:54 +0000 (Mon, 27 Aug 2012) Log Message: ----------- - Add -no_lip option to prevent automatically issueing a LIP after a configuration change. Modified Paths: -------------- trunk/scstadmin/scstadmin.sysfs/scstadmin Modified: trunk/scstadmin/scstadmin.sysfs/scstadmin =================================================================== --- trunk/scstadmin/scstadmin.sysfs/scstadmin 2012-08-24 21:15:38 UTC (rev 4473) +++ trunk/scstadmin/scstadmin.sysfs/scstadmin 2012-08-27 14:38:54 UTC (rev 4474) @@ -202,6 +202,8 @@ -issue_lip [<t>] [-driver <driver>] : Issue a LIP for a specific driver/target or for all drivers and targets. + -no_lip : Don't automatically issue a LIP after applying + configuration changes. Options -nonkey : When writing a config file or listing attributes, @@ -343,6 +345,7 @@ my $enableTarget; my $disableTarget; my $issueLip; + my $noLip; my $handler; my $attributes; @@ -437,6 +440,7 @@ 'enable_target=s' => \$enableTarget, 'disable_target=s' => \$disableTarget, 'issue_lip:s' => \$issueLip, + 'no_lip' => \$noLip, 'handler=s' => \$handler, 'attributes=s' => \$attributes, @@ -470,6 +474,7 @@ $force = TRUE if (defined($force)); $nonkey = TRUE if (defined($nonkey)); + $noLip = TRUE if (defined($noLip)); my $query_mode = defined($listHandler) || defined($listDevice) || defined($listDeviceGroup) || defined($listTargetGroup) || defined($listDriver) || defined($listTarget) || defined($listGroup) || defined($listSessions) || @@ -711,7 +716,7 @@ $addGroup, $removeGroup, $addInitiator, $removeInitiator, $moveInitiator, $clearInitiators, $addLun, $removeLun, $replaceLun, $clearLuns, - $enableTarget, $disableTarget, $issueLip, + $enableTarget, $disableTarget, $issueLip, $noLip, $handler, \%_attributes, $driver, $target, $group, $to, $device,, $deviceGroup, $targetGroup, $nonkey, $force); @@ -740,7 +745,7 @@ $addGroup, $removeGroup, $addInitiator, $removeInitiator, $moveInitiator, $clearInitiators, $addLun, $removeLun, $replaceLun, $clearLuns, - $enableTarget, $disableTarget, $issueLip, + $enableTarget, $disableTarget, $issueLip, $noLip, $handler, $attributes, $driver, $target, $group, $to, $device, $deviceGroup, $targetGroup, $nonkey, $force) = getArgs(); @@ -759,7 +764,7 @@ immediateExit("Configuration has errors, aborting.") if ($rc); last if ($force && prompt()); my $changes = applyConfiguration($force); - $rc = issueLip() if ($changes); + $rc = issueLip() if ($changes && !$noLip); last SWITCH; }; defined($checkConfig) && do { @@ -775,7 +780,7 @@ defined($clearConfig) && do { last if (prompt()); $rc = clearConfiguration(); - $rc = issueLip() if (!$rc); + $rc = issueLip() if (!$rc && !$noLip); last SWITCH; }; defined($listHandler) && do { @@ -934,14 +939,14 @@ defined($addDriverAttr) && do { print "\n-> Making requested changes.\n"; $rc = addDriverDynamicAttributes($addDriverAttr, $attributes); - $rc = issueLip() if (!$rc); + $rc = issueLip() if (!$rc && !$noLip); print "\t-> Done.\n"; last SWITCH; }; defined($addTargetAttr) && do { print "\n-> Making requested changes.\n"; $rc = addTargetDynamicAttributes($driver, $addTargetAttr, $attributes); - $rc = issueLip() if (!$rc); + $rc = issueLip() if (!$rc && !$noLip); print "\t-> Done.\n"; last SWITCH; }; @@ -949,7 +954,7 @@ last if (prompt()); print "\n-> Making requested changes.\n"; $rc = removeDriverDynamicAttributes($remDriverAttr, $attributes); - $rc = issueLip() if (!$rc); + $rc = issueLip() if (!$rc && !$noLip); print "\t-> Done.\n"; last SWITCH; }; @@ -957,7 +962,7 @@ last if (prompt()); print "\n-> Making requested changes.\n"; $rc = removeTargetDynamicAttributes($driver, $remTargetAttr, $attributes); - $rc = issueLip() if (!$rc); + $rc = issueLip() if (!$rc && !$noLip); print "\t-> Done.\n"; last SWITCH; }; @@ -971,14 +976,14 @@ last if (prompt()); print "\n-> Making requested changes.\n"; $rc = closeDevice($handler, $closeDev, $force); - $rc = issueLip() if (!$rc); + $rc = issueLip() if (!$rc && !$noLip); print "\t-> Done.\n"; last SWITCH; }; defined($resyncDev) && do { print "\n-> Making requested changes.\n"; $rc = resyncDevice($resyncDev); - $rc = issueLip() if (!$rc); + $rc = issueLip() if (!$rc && !$noLip); print "\t-> Done.\n"; last SWITCH; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mga...@us...> - 2013-01-11 18:00:02
|
Revision: 4728 http://scst.svn.sourceforge.net/scst/?rev=4728&view=rev Author: mgandalf Date: 2013-01-11 17:59:51 +0000 (Fri, 11 Jan 2013) Log Message: ----------- Truncate config file instead of deleting it before writing. Modified Paths: -------------- trunk/scstadmin/scstadmin.sysfs/scstadmin Modified: trunk/scstadmin/scstadmin.sysfs/scstadmin =================================================================== --- trunk/scstadmin/scstadmin.sysfs/scstadmin 2013-01-09 01:42:10 UTC (rev 4727) +++ trunk/scstadmin/scstadmin.sysfs/scstadmin 2013-01-11 17:59:51 UTC (rev 4728) @@ -1330,16 +1330,8 @@ sub writeConfiguration { my $nonkey = shift; - if (-f $CONFIGFILE) { - if (!unlink $CONFIGFILE) { - print "Failed to save current configuration, specified ". - "file exists and cannot be deleted.\n"; - return 1; - } - } + my $io = new IO::File $CONFIGFILE, O_CREAT|O_WRONLY|O_TRUNC; - my $io = new IO::File $CONFIGFILE, O_CREAT|O_WRONLY; - if (!$io) { print "Failed to save configuration to file '$CONFIGFILE': $!\n"; return 1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bva...@us...> - 2013-07-01 11:57:23
|
Revision: 4907 http://sourceforge.net/p/scst/svn/4907 Author: bvassche Date: 2013-07-01 11:57:19 +0000 (Mon, 01 Jul 2013) Log Message: ----------- scstadmin: Escape special characters in initiator names in the LUN masking section Write out e.g. "INITIATOR iqn.1994-05.com.redhat:29a5cc399d\#192.168.11.1" instead of "INITIATOR iqn.1994-05.com.redhat:29a5cc399d#192.168.11.1" when generating a config file such that the hash sign is read in properly when rereading the SCST config file. Modified Paths: -------------- trunk/scstadmin/scstadmin.sysfs/scstadmin Modified: trunk/scstadmin/scstadmin.sysfs/scstadmin =================================================================== --- trunk/scstadmin/scstadmin.sysfs/scstadmin 2013-06-25 18:01:50 UTC (rev 4906) +++ trunk/scstadmin/scstadmin.sysfs/scstadmin 2013-07-01 11:57:19 UTC (rev 4907) @@ -1532,7 +1532,7 @@ my $init_buff; foreach my $init (sort @{$inits}) { - $init_buff .= "\n\t\t\tINITIATOR $init"; + $init_buff .= "\n\t\t\tINITIATOR " . escapeMeta($init); my $attributes = $SCST->initiatorAttributes($driver, $target, $group, $init); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bva...@us...> - 2013-07-30 10:41:19
|
Revision: 4927 http://sourceforge.net/p/scst/svn/4927 Author: bvassche Date: 2013-07-30 10:41:15 +0000 (Tue, 30 Jul 2013) Log Message: ----------- scstadmin: Save multi-valued attributes sorted Modified Paths: -------------- trunk/scstadmin/scstadmin.sysfs/scstadmin Modified: trunk/scstadmin/scstadmin.sysfs/scstadmin =================================================================== --- trunk/scstadmin/scstadmin.sysfs/scstadmin 2013-07-29 10:43:00 UTC (rev 4926) +++ trunk/scstadmin/scstadmin.sysfs/scstadmin 2013-07-30 10:41:15 UTC (rev 4927) @@ -1281,13 +1281,15 @@ && defined($$attr_filter{$attribute}))); if (defined($$attributes{$attribute}->{'keys'})) { - foreach my $key (sort keys %{$$attributes{$attribute}->{'keys'}}) { + my @values; + foreach my $key (keys %{$$attributes{$attribute}->{'keys'}}) { my $value = $$attributes{$attribute}->{'keys'}->{$key}->{'value'}; - if ($value ne '') { - $result .= "$prefix$attribute " . escapeMeta($value) . "\n"; - } + push (@values, $value) if ($value ne ''); } + foreach my $value (sort @values) { + $result .= "$prefix$attribute " . escapeMeta($value) . "\n"; + } } elsif ($attribute eq 'enabled' || $attribute eq 'hw_target') { my $value = $$attributes{$attribute}->{'value'}; $result .= "$prefix$attribute $value\n"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bva...@us...> - 2013-08-04 18:16:53
|
Revision: 4942 http://sourceforge.net/p/scst/svn/4942 Author: bvassche Date: 2013-08-04 18:16:51 +0000 (Sun, 04 Aug 2013) Log Message: ----------- scstadmin: Enable targets after the ALUA configuration has been restored Modified Paths: -------------- trunk/scstadmin/scstadmin.sysfs/scstadmin Modified: trunk/scstadmin/scstadmin.sysfs/scstadmin =================================================================== --- trunk/scstadmin/scstadmin.sysfs/scstadmin 2013-08-04 18:15:28 UTC (rev 4941) +++ trunk/scstadmin/scstadmin.sysfs/scstadmin 2013-08-04 18:16:51 UTC (rev 4942) @@ -1957,6 +1957,8 @@ $changes += applyConfigAssignments($CONFIG, $force); $changes += applyConfigAlua($CONFIG, $force); $changes += applyConfigDeviceGroups($CONFIG, $force); + $changes += applyConfigEnableTargets($CONFIG, $force); + $changes += applyConfigEnableDrivers($CONFIG, $force); # And SCST attributes.. my %_attributes; @@ -2191,17 +2193,13 @@ } 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 + # Enabling a driver happens in applyConfigEnableDrivers() $_attributes{$item} = $$assignments{$driver}->{$item}; - } else { - $special{$item} = $$assignments{$driver}->{$item}; - } } @@ -2210,8 +2208,27 @@ if (scalar keys %{$attributes}) { $changes += setDriverAttributes($driver, $attributes, $deletions); } + } - $attributes = configToAttr(\%special); + return $changes; +} + +sub applyConfigEnableDrivers { + my $config = shift; + my $deletions = shift; + my $changes = 0; + + my $assignments = $$config{'TARGET_DRIVER'}; + + foreach my $driver (sort keys %{$assignments}) { + my %_attributes; + foreach my $item (keys %{$$assignments{$driver}}) { + if ($item eq 'enabled') { + $_attributes{$item} = $$assignments{$driver}->{$item}; + } + } + + my $attributes = configToAttr(\%_attributes); my $d_attributes = $SCST->driverAttributes($driver); if (defined($$d_attributes{'enabled'}) && @@ -2498,25 +2515,47 @@ 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}); - } elsif ($item eq 'enabled') { - $_attributes{$item} = $$targets{$target}->{$item}; } } + } - $attributes = configToAttr(\%_attributes); - my $t_attributes = $SCST->targetAttributes($driver, $target); + return $changes; +} - if (defined($$t_attributes{'enabled'}) && - ($$t_attributes{'enabled'}->{'value'} != $$attributes{'enabled'})) { - setTargetAttribute($driver, $target, 'enabled', $$attributes{'enabled'}); - $changes++; +sub applyConfigEnableTargets { + my $config = shift; + my $deletions = shift; + my $changes = 0; + + my $assignments = $$config{'TARGET_DRIVER'}; + + foreach my $driver (sort keys %{$assignments}) { + foreach my $driver_item (keys %{$$assignments{$driver}}) { + next if ($driver_item ne 'TARGET'); + my $targets = $$assignments{$driver}->{$driver_item}; + foreach my $target (sort keys %{$targets}) { + my %_attributes = (); + foreach my $target_item (keys %{$$targets{$target}}) { + if ($target_item eq 'enabled') { + $_attributes{$target_item} = $$targets{$target}->{$target_item}; + } + } + + my $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++; + } + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |