]> git.proxmox.com Git - pve-storage.git/commitdiff
Fixed Istgt LUN Options handling.
authorChris Allen <Chris Allen>
Tue, 11 Mar 2014 17:46:24 +0000 (10:46 -0700)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 25 Jun 2014 07:13:45 +0000 (09:13 +0200)
Signed-off-by: Chris Allen <Chris Allen>
PVE/Storage/LunCmd/Istgt.pm

index 2d59ef30fdad0ada13929f4ebd0f0ad10d57456b..c17d1c89e8865a57afd40a467e03de5a5676da01 100644 (file)
@@ -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};
                 }
             }