Added "nowritecache" option to ZFS storage plugin. Turns off write caching on Comstar and Istgt LUNs created by the plugin. Has no effect on IET, as IET always uses write-through caching for blockio volumes not in read-only mode.
Signed-off-by: Chris Allen <Chris Allen>
This commit is contained in:
committed by
Dietmar Maurer
parent
a9bd7bdfdc
commit
70986fd9e4
@ -50,11 +50,15 @@ sub run_lun_command {
|
||||
};
|
||||
|
||||
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') {
|
||||
|
||||
@ -173,6 +173,11 @@ my $lun_dumper = sub {
|
||||
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";
|
||||
|
||||
@ -228,16 +233,21 @@ my $free_lu_name = sub {
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
@ -274,7 +284,7 @@ my $parser = sub {
|
||||
} 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 {
|
||||
@ -349,7 +359,7 @@ my $create_lun = sub {
|
||||
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' $!";
|
||||
|
||||
|
||||
@ -328,10 +328,16 @@ sub properties {
|
||||
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,
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -345,6 +351,7 @@ sub options {
|
||||
pool => { fixed => 1 },
|
||||
blocksize => { fixed => 1 },
|
||||
iscsiprovider => { fixed => 1 },
|
||||
nowritecache => { optional => 1 },
|
||||
sparse => { optional => 1 },
|
||||
content => { optional => 1 },
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user