- Add the ability to specify options (ie: READ_ONLY) in assignments in scst.conf.

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1109 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Mark Buechler
2009-09-17 20:32:35 +00:00
parent 8de256e7a3
commit 5bf03c83ea
5 changed files with 29 additions and 15 deletions

View File

@@ -2,6 +2,7 @@ Changes for 1.0.9
- Move a user from one group to another when applying the configuration instead
of deleting from one and adding to another the same user.
- Add the ability to specify options (ie: READ_ONLY) in assignments in scst.conf.
- Minor fix to readConfig() which wasn't fully allowing for empty groups.
Changes for 1.0.8

View File

@@ -68,3 +68,9 @@ NOTE! Section "[TARGETS enable]" in the config file is for qla2x00t driver only!
Mark.Buechler@gmail.com
To Do:
======
- Compare device and assignment options between current and saved configurations and
reopen/reassign as required if -ForceConfig is used.

View File

@@ -1,4 +1,6 @@
# Automatically generated by scst.
# Automatically generated by SCST Configurator v1.0.8.
# NOTE: Options are pipe (|) seperated.
[HANDLER vdisk]
#DEVICE <vdisk name>,<device path>,<options>,<block size>
@@ -58,45 +60,46 @@ USER 21:00:00:e0:8b:11:a6:8b
USER 21:00:00:e0:8b:11:75:8b
[ASSIGNMENT CORBIN2_a]
#ASSIGNMENT <device name>,<lun>,<options>
DEVICE MP15K009,0
DEVICE MS10K006,1
DEVICE RG10K000,2
DEVICE RG72K001,3
[ASSIGNMENT CORBIN3_a]
#ASSIGNMENT <device name>,<lun>
#ASSIGNMENT <device name>,<lun>,<options>
DEVICE MP15K00d,0
[ASSIGNMENT Default]
#ASSIGNMENT <device name>,<lun>
#ASSIGNMENT <device name>,<lun>,<options>
DEVICE GW15K000,0
DEVICE GW15K001,1
[ASSIGNMENT MENTASM_a]
#ASSIGNMENT <device name>,<lun>
#ASSIGNMENT <device name>,<lun>,<options>
DEVICE MP15K006,0
DEVICE MP15K008,1
DEVICE MP15K00e,2
[ASSIGNMENT PC1_a]
#ASSIGNMENT <device name>,<lun>
#ASSIGNMENT <device name>,<lun>,<options>
DEVICE MS15K000,0
[ASSIGNMENT PC2_a]
#ASSIGNMENT <device name>,<lun>
#ASSIGNMENT <device name>,<lun>,<options>
DEVICE MS15K005,0
[ASSIGNMENT PC3_a]
#ASSIGNMENT <device name>,<lun>
#ASSIGNMENT <device name>,<lun>,<options>
DEVICE MP15K00c,0
[ASSIGNMENT PC4_a]
#ASSIGNMENT <device name>,<lun>
#ASSIGNMENT <device name>,<lun>,<options>
DEVICE MP15K005,0
DEVICE MP15K007,1
[ASSIGNMENT RAISTLIN_a]
#ASSIGNMENT <device name>,<lun>
#ASSIGNMENT <device name>,<lun>,<options>
DEVICE MP15K00a,0
DEVICE MP15K00b,1

View File

@@ -886,7 +886,8 @@ sub assignDeviceToGroup {
($options, $valid_opts) = $self->checkOptions($options, 'ASSIGN');
if (!$valid_opts) {
$self->{'error'} = "assignDeviceToGroup(): Invalid option(s) '$options' given for device '$device'";
$self->{'error'} = "assignDeviceToGroup(): Invalid option(s) '$options' given for ".
"device '$device' in assignment";
return 1;
}

View File

@@ -552,6 +552,8 @@ sub writeConfiguration {
print $io "# Automatically generated by $Version.\n\n";
print $io "# NOTE: Options are pipe (|) seperated.\n\n";
# Device information
foreach my $handler (sort keys %HANDLERS) {
print $io "[HANDLER ".$_REVERSE_MAP_{$handler}."]\n";
@@ -600,7 +602,7 @@ sub writeConfiguration {
# Assignments configuration
foreach my $group (sort keys %ASSIGNMENTS) {
print $io "[ASSIGNMENT $group]\n";
print $io "#DEVICE <device name>,<lun>\n";
print $io "#DEVICE <device name>,<lun>,<options>\n";
my $pointer = $ASSIGNMENTS{$group};
foreach my $device (sort keys %{$pointer}) {
@@ -674,9 +676,9 @@ sub applyConfiguration {
# Cache device association configuration
foreach my $group (keys %{$$config{'ASSIGNMENT'}}) {
foreach my $device (@{$$config{'ASSIGNMENT'}->{$group}->{'DEVICE'}}) {
my($vname, $lun) = split(/\,/, $device);
my($vname, $arg) = split(/\,/, $device, 2);
$vname = cleanupString($vname);
$used_assignments{$group}->{$vname} = $lun;
$used_assignments{$group}->{$vname} = $arg;
}
}
@@ -943,7 +945,8 @@ sub applyConfiguration {
}
foreach my $vname (keys %{$used_assignments{$group}}) {
my $lun = $used_assignments{$group}->{$vname};
my $arg = $used_assignments{$group}->{$vname};
my($lun, $options) = split(/\,/, $arg);
my $_assignments = $ASSIGNMENTS{$group};
if (defined($$_assignments{$vname}) && ($$_assignments{$vname} == $lun)) {
@@ -958,7 +961,7 @@ sub applyConfiguration {
print "\t-> New device assignment for '$vname' to group '$group' at LUN $lun.\n";
$changes++;
} else {
if (assignDevice($group, $vname, $lun)) {
if (assignDevice($group, $vname, $lun, $options)) {
$errs++;
} else {
$changes++;