- An even better fix for the previous create attribute bug.

- Consider create attributes for LUNs within groups as well.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@2014 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Mark Buechler
2010-08-26 22:52:04 +00:00
parent 3f26d8f75c
commit 164d28ce66

View File

@@ -1652,7 +1652,8 @@ sub applyConfigAssignments {
filterCreateAttributes($possible, $c_attrs, TRUE);
if (compareToKeyAttribute($c_attrs, $o_attrs)) {
print "-> Device '$device' at LUN '$lun' is configured differently.\n";
print "-> Assigned device '$device' in target '$target' at ".
"LUN '$lun' is configured differently.\n";
if ($deletions) {
print "\t-> Re-assigning device with new attributes.\n";
@@ -1683,6 +1684,28 @@ sub applyConfigAssignments {
"for driver/target/group '$driver/$target/$group'. ".
"Use -force to remove it.\n";
}
} else {
my $c_attrs = configToAttr($$config{'TARGET_DRIVER'}->{$driver}->{'TARGET'}->{$target}->{'GROUP'}->{$group}->{'LUN'}->{$lun}->{$device});
my $o_attrs = $SCST->lunAttributes($driver, $target, $lun, $group);
immediateExit($SCST->errorString());
my $possible = $SCST->lunCreateAttributes($driver, $target, $group);
immediateExit($SCST->errorString());
filterCreateAttributes($possible, $c_attrs, TRUE);
if (compareToKeyAttribute($c_attrs, $o_attrs)) {
print "-> Assigned device '$device' in group '$group' ".
"at LUN '$lun' is configured differently.\n";
if ($deletions) {
print "\t-> Re-assigning device with new attributes.\n";
removeLun($driver, $target, $lun, $group);
addLun($driver, $target, $device, $lun, $c_attrs, $group);
} else {
print "\t-> Use -force to re-assign device with new attributes. ".
"NOTE: This will disrupt all initiators using this device.\n";
}
}
}
}
@@ -1860,9 +1883,9 @@ sub filterCreateAttributes {
my $keep = shift;
foreach my $attribute (keys %{$attrs}) {
my $bad = defined($$creates{$attribute});
my $good = defined($$creates{$attribute});
if (($keep && $bad) || (!$keep && !$bad)) {
if (($keep && !$good) || (!$keep && !$good)) {
delete $$attrs{$attribute};
}
}