Merge branch 'svn-trunk'

This commit is contained in:
Bart Van Assche
2018-01-04 18:00:20 -08:00
4 changed files with 30 additions and 14 deletions

View File

@@ -2612,19 +2612,26 @@ sub deviceAttributes {
my $linked = readlink make_path($pPath, $export);
my $t = SCST_TARGETS;
my $g = SCST_GROUPS;
my $l = SCST_LUNS;
my ($driver, $target, $group, $lun) = "" x 4;
if ($linked =~ /.*\/(.+)\/(.+)\/$g\/(.+)\/$l\/(\d+)/) {
my $driver = $1;
my $target = $2;
my $group = $3;
my $lun = $4;
next if ($target eq 'copy_manager');
$attributes{$attribute}->{'value'}->{$driver}->{$target}->{$group} = $lun;
if ($linked =~ /^(\.\.\/)*$t\/([^\/]+)\/([^\/]+)\/$g\/([^\/]+)\/$l\/(\d+)$/) {
$driver = $2;
$target = $3;
$group = $4;
$lun = $5;
} elsif ($linked =~ /^(\.\.\/)*$t\/([^\/]+)\/([^\/]+)\/$l\/(\d+)$/) {
$driver = $2;
$target = $3;
$lun = $4;
} else {
print("internal error: could not parse $linked\n");
next;
}
next if ($driver eq 'copy_manager');
$attributes{$attribute}->{'value'}->{$driver}->{$target}->{$group} = $lun;
}
if ($attributes{$attribute}->{'value'}) {
$attributes{$attribute}->{'static'} = TRUE;

View File

@@ -52,6 +52,7 @@ sub testRestoreConfig {
my $compare_result = system("diff -u $tmpfilename2 $expected >$diff");
ok($compare_result, 0);
if ($compare_result == 0) {
unlink($diff);
unlink($tmpfilename2);
unlink($tmpfilename1);
}

View File

@@ -73,6 +73,7 @@ sub attributeTest {
my $compare_result = system("diff -u $tmpfilename2 $expected >$diff");
ok($compare_result, 0);
if ($compare_result == 0) {
unlink($diff);
unlink($tmpfilename2);
unlink($tmpfilename1);
}

View File

@@ -21,7 +21,7 @@ BEGIN {
unless(grep /blib/, @INC) {
unshift(@INC, File::Spec->catdir($scstadmin_pm_dir, "lib"));
}
plan tests => 5;
plan tests => 9;
}
use Data::Dumper;
@@ -91,13 +91,20 @@ sub closeDevTest {
$rc = system("$scstadmin -dumpAttrs $redirect");
ok($rc, 0);
$rc = closeDevs("nodev");
ok($rc, 256);
$rc = system("$scstadmin -noprompt -driver scst_local -target local " .
"-rem_lun 0 -device nodev $redirect");
ok($rc, 0);
$rc = closeDevs("nodev");
ok($rc, 0);
$rc = closeDevs("disk0", "disk1");
ok($rc, 256);
system("$scstadmin -noprompt -driver scst_local -target local -group ig " .
"-rem_lun 0 -device disk0 $redirect");
system("$scstadmin -noprompt -driver scst_local -target local -group ig " .
"-rem_lun 1 -device disk1 $redirect");
$rc = system("$scstadmin -noprompt -driver scst_local -target local " .
"-group ig -rem_lun 0 -device disk0 $redirect");
ok($rc, 0);
$rc = system("$scstadmin -noprompt -driver scst_local -target local " .
"-group ig -rem_lun 1 -device disk1 $redirect");
ok($rc, 0);
$rc = closeDevs("disk0", "disk1");
ok($rc, 0);
if ($rc == 0) {