scstadmin: Fix parsing of the soft links under the 'exported' directory

Reported-by: Dzmitry Kotsikau <dkotsikau@gmail.com>


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7326 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2018-01-04 18:02:47 +00:00
parent 7baba46a23
commit e0903d4ce0

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;