};
if ($method eq 'create_lu') {
+ my $wcd = 'false';
+ if ($scfg->{nowritecache}) {
+ $wcd = 'true';
+ }
my $prefix = '600144f';
my $digest = md5_hex($params[0]);
$digest =~ /(\w{7}(.*))/;
$guid = "$prefix$2";
- @params = ('-p', 'wcd=false', '-p', "guid=$guid", @params);
+ @params = ('-p', "wcd=$wcd", '-p', "guid=$guid", @params);
} elsif ($method eq 'modify_lu') {
@params = ('-s', @params);
} elsif ($method eq 'list_view') {
foreach my $conf (@{$SETTINGS->{$lun}->{luns}}) {
$config .= "$conf->{lun} Storage " . $conf->{Storage};
$config .= ' ' . $size_with_unit->($conf->{Size}) . "\n";
+ foreach ($conf->{options}) {
+ if ($_) {
+ $config .= "$conf->{lun} Option " . $_ . "\n";
+ }
+ }
}
$config .= "\n";
};
my $make_lun = sub {
- my ($path) = @_;
+ my ($scfg, $path) = @_;
my $target = $SETTINGS->{current};
die 'Maximum number of LUNs per target is 63' if scalar @{$SETTINGS->{$target}->{luns}} >= $MAX_LUNS;
+ my @options = ();
my $lun = $get_lu_name->($target);
+ if ($scfg->{nowritecache}) {
+ push @options, "WriteCache Disable";
+ }
my $conf = {
lun => $lun,
Storage => $path,
Size => 'AUTO',
+ options => @options,
};
push @{$SETTINGS->{$target}->{luns}}, $conf;
} elsif ($lun) {
next if (($_ =~ /^\s*#/) || ($_ =~ /^\s*$/));
if ($_ =~ /^\s*(\w+)\s+(.+)\s*/) {
- #next if $2 =~ /^Option.*/;
+ next if $2 =~ /^Option.*/;
$SETTINGS->{$lun}->{$1} = $2;
$SETTINGS->{$lun}->{$1} =~ s/^\s+|\s+$|"\s*//g;
} else {
die "$params[0]: LUN exists";
}
my $lun = $params[0];
- $lun = $make_lun->($lun);
+ $lun = $make_lun->($scfg, $lun);
my $config = $lun_dumper->($SETTINGS->{current});
open(my $fh, '>', $file) or die "Could not open file '$file' $!";
description => "block size",
type => 'string',
},
+ # this will disable write caching on comstar and istgt.
+ # it is not implemented for iet. iet blockio always operates with
+ # writethrough caching when not in readonly mode
+ nowritecache => {
+ description => "disable write caching on the target",
+ type => 'boolean',
+ },
sparse => {
description => "use sparse volumes",
type => 'boolean',
- optional => 1,
}
};
}
pool => { fixed => 1 },
blocksize => { fixed => 1 },
iscsiprovider => { fixed => 1 },
+ nowritecache => { optional => 1 },
sparse => { optional => 1 },
content => { optional => 1 },
};