From 551534a3bc8bceae1f16417bead49b1c2aaaf91a Mon Sep 17 00:00:00 2001 From: Chris Allen Date: Tue, 11 Mar 2014 10:46:24 -0700 Subject: [PATCH] Fixed Istgt LUN Options handling. Signed-off-by: Chris Allen --- PVE/Storage/LunCmd/Istgt.pm | 38 +++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/PVE/Storage/LunCmd/Istgt.pm b/PVE/Storage/LunCmd/Istgt.pm index 2d59ef3..c17d1c8 100644 --- a/PVE/Storage/LunCmd/Istgt.pm +++ b/PVE/Storage/LunCmd/Istgt.pm @@ -284,9 +284,15 @@ my $parser = sub { } elsif ($lun) { next if (($_ =~ /^\s*#/) || ($_ =~ /^\s*$/)); if ($_ =~ /^\s*(\w+)\s+(.+)\s*/) { - next if $2 =~ /^Option.*/; - $SETTINGS->{$lun}->{$1} = $2; - $SETTINGS->{$lun}->{$1} =~ s/^\s+|\s+$|"\s*//g; + my $arg1 = $1; + $2 =~ s/^\s+|\s+$|"\s*//g; + if ($2 =~ /^Storage\s*(.+)/i) { + $SETTINGS->{$lun}->{$arg1}->{storage} = $1; + } elsif ($2 =~ /^Option\s*(.+)/i) { + push @{$SETTINGS->{$lun}->{$arg1}->{options}}, $1; + } else { + $SETTINGS->{$lun}->{$arg1} = $2; + } } else { die "$line: parse error [$_]"; } @@ -305,19 +311,23 @@ my $parser = sub { my $lu = (); while ((my $key, my $val) = each(%{$SETTINGS->{"LogicalUnit$i"}})) { if ($key =~ /^LUN\d+/) { - if ($val =~ /^Storage\s+([\w\/\-]+)\s+(\w+)/) { - my $storage = $1; - my $size = $parse_size->($2); - my $conf = undef; - if ($storage =~ /^$base\/$scfg->{pool}\/([\w\-]+)$/) { - $conf = { - lun => $key, - Storage => $storage, - Size => $size, - }; + $val->{storage} =~ /^([\w\/\-]+)\s+(\w+)/; + my $storage = $1; + my $size = $parse_size->($2); + my $conf = undef; + my @options = (); + if ($val->{options}) { + @options = @{$val->{options}}; + } + if ($storage =~ /^$base\/$scfg->{pool}\/([\w\-]+)$/) { + $conf = { + lun => $key, + Storage => $storage, + Size => $size, + options => @options, } - push @$lu, $conf if $conf; } + push @$lu, $conf if $conf; delete $SETTINGS->{"LogicalUnit$i"}->{$key}; } } -- 2.39.2