Discussion:
[pve-devel] [PATCH storage 0/2] Add SCST provider to ZFS over iSCSI
Dzmitry Kotsikau
2018-05-03 12:50:20 UTC
Permalink
SCTS target can be installed on Proxmox node with ZFS

sudo apt-get install subversion quilt dkms gawk build-essential flex bison automake autoconf devscripts pve-headers
svn checkout svn://svn.code.sf.net/p/scst/svn/trunk scst-trunk
cd scst-trunk
make dpkg
cd dpkg
sudo dpkg -i iscsi-scst_*_amd64.deb scst-dkms_*_all.deb scstadmin_*_amd64.deb

After installation SCST requires at least one empty iSCSI target to be created.

So /etc/scst.conf file may contain something like this:

TARGET_DRIVER iscsi {
enabled 1

TARGET iqn.2006-10.com.scst:orion {
allowed_portal 192.168.254.10
enabled 1
rel_tgt_id 1
}
}

Block size option in the target configuration affects only ZFS. I tried to syncronize SCST block size and ZFS block size,
but qemu-image fails to convert such disks. It looks like a qemu bug. It may convert disks < 2GB but will fail on bigger virtual disks.
So SCST creates volumes with 512 block size.


Dzmitry Kotsikau (2):
add SCST provider to ZFS over iSCSI storage type
fix scstadmin path to support installation from deb packages

PVE/Storage/LunCmd/Makefile | 2 +-
PVE/Storage/LunCmd/Scst.pm | 557 ++++++++++++++++++++++++++++++++++++++++++++
PVE/Storage/ZFSPlugin.pm | 15 +-
3 files changed, 570 insertions(+), 4 deletions(-)
create mode 100644 PVE/Storage/LunCmd/Scst.pm
--
2.11.0
Dzmitry Kotsikau
2018-05-03 12:50:21 UTC
Permalink
Signed-off-by: Dzmitry Kotsikau <***@gmail.com>
---
PVE/Storage/LunCmd/Makefile | 2 +-
PVE/Storage/LunCmd/Scst.pm | 557 ++++++++++++++++++++++++++++++++++++++++++++
PVE/Storage/ZFSPlugin.pm | 15 +-
3 files changed, 570 insertions(+), 4 deletions(-)
create mode 100644 PVE/Storage/LunCmd/Scst.pm

diff --git a/PVE/Storage/LunCmd/Makefile b/PVE/Storage/LunCmd/Makefile
index b959255..5a44cbd 100644
--- a/PVE/Storage/LunCmd/Makefile
+++ b/PVE/Storage/LunCmd/Makefile
@@ -1,4 +1,4 @@
-SOURCES=Comstar.pm Istgt.pm Iet.pm
+SOURCES=Comstar.pm Istgt.pm Iet.pm Scst.pm

.PHONY: install
install:
diff --git a/PVE/Storage/LunCmd/Scst.pm b/PVE/Storage/LunCmd/Scst.pm
new file mode 100644
index 0000000..4e0a67b
--- /dev/null
+++ b/PVE/Storage/LunCmd/Scst.pm
@@ -0,0 +1,557 @@
+package PVE::Storage::LunCmd::Scst;
+
+#1) Install scst on proxmox node
+
+#apt-get install git gawk build-essential flex bison automake autoconf pve-headers dkms
+#git clone https://github.com/bvanassche/scst.git
+#cd scst
+#make scst scst_local iscsi-scst scst srpt usr
+#make scst_install scst_local_install iscsi_install scst_install srpt_install usr_install
+#depmod -a
+#cat > /etc/default/scst << 'EOF'
+#ISCSID_OPTIONS="-a 192.168.254.10 -u0 -g0 -p3260"
+#SCST_TARGET_MODULES="scst scst_vdisk iscsi-scst"
+#EOF
+
+#2) Create portal
+
+#cat > /etc/scst.conf <'EOF'
+#TARGET_DRIVER iscsi {
+# DefaultTime2Wait 2
+# DefaultTime2Retain 90
+# enabled 1
+#}
+#EOF
+
+
+
+
+use strict;
+use warnings;
+use PVE::Tools qw(run_command file_read_firstline trim dir_glob_regex dir_glob_foreach);
+use Data::Dumper;
+
+sub get_base;
+
+# A logical unit can max have 16383 LUNs
+my $MAX_LUNS = 16383;
+my $HANDLER = 'vdisk_fileio';
+
+my $CONFIG_FILE = '/etc/scst.conf';
+my $CONFIG_FILE_TMP = '/tmp/pve-scst.conf';
+
+my $DAEMON = '/usr/local/sbin/iscsi-scstd';
+my $SETTINGS = undef;
+my $CONFIG;
+
+my @ssh_opts = ('-o', 'BatchMode=yes', '-o','PreferredAuthentications=publickey');
+my @ssh_cmd = ('/usr/bin/ssh', @ssh_opts);
+my @scp_cmd = ('/usr/bin/scp', @ssh_opts);
+my $id_rsa_path = '/etc/pve/priv/zfs';
+my $scstadmin = '/usr/local/sbin/scstadmin';
+
+my $execute_command = sub {
+ my ($scfg, $exec, $timeout, $method, @params) = @_;
+
+ my $msg = '';
+ my $err = undef;
+ my $target;
+ my $cmd;
+ my $res = ();
+
+ $timeout = 10 if !$timeout;
+
+ my $output = sub {
+ my $line = shift;
+ $msg .= "$line\n";
+ };
+
+ my $errfunc = sub {
+ my $line = shift;
+ $err .= "$line";
+ };
+
+ if ($exec eq 'scp') {
+ $target = 'root@[' . $scfg->{portal} . ']';
+ $cmd = [@scp_cmd, '-i', "$id_rsa_path/$scfg->{portal}_id_rsa", '--', $method, "$target:$params[0]"];
+ } else {
+ $target = 'root@' . $scfg->{portal};
+ $cmd = [@ssh_cmd, '-i', "$id_rsa_path/$scfg->{portal}_id_rsa", $target, '--', $method, @params];
+ }
+
+ eval {
+ run_command($cmd, outfunc => $output, errfunc => $errfunc, timeout => $timeout);
+ };
+ if ($@) {
+ $res = {
+ result => 0,
+ msg => $err,
+ }
+ } else {
+ $res = {
+ result => 1,
+ msg => $msg,
+ }
+ }
+
+ return $res;
+};
+
+my $update_config = sub {
+ my ($scfg) = @_;
+
+ my @params = ('-write_config ', $CONFIG_FILE);
+ my $res = $execute_command->($scfg, 'ssh', undef, $scstadmin, @params);
+ die $res->{msg} unless $res->{result};
+};
+
+my $get_target_tid = sub {
+ my ($scfg) = @_;
+
+ my $res = {msg => undef };
+
+ my @params = ("/sys/kernel/scst_tgt/targets/iscsi/$scfg->{target}/tid");
+ $res = $execute_command->($scfg, 'ssh', 10, 'test', '-f', @params);
+ die "The target not found! ". $res->{msg} unless $res->{result};
+
+ my $tid = undef;
+
+ $res = $execute_command->($scfg, 'ssh', undef, 'cat', @params);
+ die $res->{msg} unless $res->{result};
+ my @lines = split "\n", $res->{msg};
+ $tid = $lines[0];
+ return $tid;
+};
+
+
+sub parseLine {
+ my $line = shift;
+ my $hash = shift;
+ my $child = shift;
+ return if (! $line);
+ return if ($line =~ /^\s*$/);
+
+ $line =~ s/^\s+//; $line =~ s/\s+$//;
+
+ my @elements;
+ while ($line =~ m/"([^"\\]*(\\.[^"\\]*)*)"|([^\s]+)/g) {
+ push @elements, defined($1) ? $1:$3;
+ }
+
+ my $attribute = $elements[0];
+ my $value = $elements[1];
+ my $value2 = $elements[2];
+
+ if (defined($attribute) && defined($value) && defined($value2)) {
+ $$hash{$attribute}->{$value}->{$value2} = $child;
+ } elsif (defined($attribute) && defined($value)) {
+ $$hash{$attribute}->{$value} = $child;
+ } elsif (defined($attribute)) {
+ $$hash{$attribute} = $child;
+ }
+};
+
+
+sub parseStanza {
+ my $buffer = shift;
+ my $line;
+ my %hash;
+ my $attribute;
+ my $value;
+ my $value2;
+ my $quoted;
+
+ while ($#{$buffer} > -1) {
+ my $char = shift @{$buffer};
+
+ if ($char eq '{') {
+ my $child = parseStanza($buffer);
+ if ($line) {
+ parseLine($line, \%hash, $child);
+ $line = undef;
+ }
+ next;
+ }
+
+ if ($char eq '}') {
+ return \%hash
+ };
+
+ if ($char eq "\n") {
+ my %empty;
+ parseLine($line, \%hash, \%empty);
+ $line = undef;
+ } else {
+ $line .= $char;
+ }
+ }
+ return \%hash;
+};
+
+sub parseLuns {
+ my $scfg = shift;
+ my $luns = shift;
+ my $h_luns = ();
+ my $base = get_base;
+
+ foreach my $lun (keys %{$$luns} ) {
+ foreach my $device (keys %{$$luns->{$lun}}) {
+ if (!defined($$CONFIG{'HANDLER'}) ||
+ !defined($$CONFIG{'HANDLER'}->{$HANDLER}) ||
+ !defined($$CONFIG{'HANDLER'}->{$HANDLER}->{'DEVICE'}->{$device})) {
+ die "Wrong configuration file $CONFIG_FILE!";
+ }
+ my $dev = $$CONFIG{'HANDLER'}->{$HANDLER}->{'DEVICE'}->{$device};
+
+ my $conf = undef;
+ $conf->{Device} = (keys %{$$dev{'prod_id'}})[0];
+ $conf->{Path} = (keys %{$$dev{'filename'}})[0];
+ $conf->{blocksize} = (keys %{$$dev{'blocksize'}})[0];
+ $conf->{size} = (keys %{$$dev{'size'}})[0];
+ if ($conf->{Path} && $conf->{Path} =~ /^$base\/$scfg->{pool}\/([\w\-]+)$/) {
+ $conf->{include} = 1;
+ } else {
+ $conf->{include} = 0;
+ }
+ $conf->{lun} = $lun;
+ push @{$h_luns}, $conf;
+ }
+ }
+ return $h_luns;
+}
+
+my $readConfigFile = sub {
+ my ($scfg) = @_;
+ my $buffer;
+ my @stanza;
+ my $level;
+ my $used = ();
+
+ my @commands = ("touch '$CONFIG_FILE_TMP'",
+ "chmod 600 '$CONFIG_FILE_TMP'",
+ "$scstadmin -write_config '$CONFIG_FILE_TMP' -nonkey",
+ "cat '$CONFIG_FILE_TMP'",
+ "rm -f '$CONFIG_FILE_TMP'"
+ );
+ my $res = $execute_command->($scfg, 'ssh', 20, join('&&', @commands));
+ die $res->{msg} unless $res->{result};
+ my @lines = split "\n", $res->{msg};
+ foreach my $line (@lines){
+ $line =~ s/^\#.*//;
+ $line =~ s/[^\\]\#.*//;
+ $line =~ s/\\(.)/$1/g;
+ $buffer .= $line."\n";
+ }
+ my @buff_a;
+ @buff_a = split(//, $buffer);
+ $CONFIG = parseStanza(\@buff_a);
+
+ if (!defined($$CONFIG{'TARGET_DRIVER'}) ||
+ !(scalar keys %{$$CONFIG{'TARGET_DRIVER'}}) ||
+ !defined($$CONFIG{'TARGET_DRIVER'}->{'iscsi'}) ||
+ !defined($$CONFIG{'TARGET_DRIVER'}->{'iscsi'}->{'TARGET'}->{$scfg->{target}})
+ )
+ {
+ die Dumper($CONFIG) ."\nWrong configuration file $CONFIG_FILE!";
+
+ }
+
+ $SETTINGS->{target} = $scfg->{target};
+ my $tgt = $$CONFIG{'TARGET_DRIVER'}->{'iscsi'}->{'TARGET'}->{$scfg->{target}};
+ if (defined($$tgt{'LUN'})) {
+ push @{$SETTINGS->{luns}}, @{parseLuns($scfg ,\$tgt->{'LUN'})};
+ }
+
+ if (defined($$tgt{'GROUP'})) {
+ foreach my $group (keys %{$$tgt{'GROUP'}}) {
+ if (defined($$tgt{'GROUP'}->{$group}->{'LUN'})) {
+ push @{$SETTINGS->{luns}}, @{parseLuns($scfg , \$tgt->{'GROUP'}->{$group}->{'LUN'} )};
+ }
+ }
+ }
+ foreach my $lun (@{$SETTINGS->{luns}}) {
+ $used->{$lun->{lun}} = 1;
+ }
+
+ $SETTINGS->{used} = $used;
+# die Dumper($SETTINGS);
+ return 0;
+};
+
+my $get_lu_name = sub {
+ my $i;
+
+ my $used = $SETTINGS->{used};
+ for ($i = 0; $i < $MAX_LUNS; $i++) {
+ last unless $used->{$i};
+ }
+ $SETTINGS->{used}->{$i} = 1;
+
+ return $i;
+};
+
+my $init_lu_name = sub {
+ foreach my $lun (@{$SETTINGS->{luns}}) {
+ $SETTINGS->{used}->{$lun->{lun}} = 1;
+ }
+};
+
+my $free_lu_name = sub {
+ my ($lu_name) = @_;
+ my $new;
+
+ foreach my $lun (@{$SETTINGS->{luns}}) {
+ if ($lun->{lun} != $lu_name) {
+ push @$new, $lun;
+ }
+ }
+
+ $SETTINGS->{luns} = $new;
+ $SETTINGS->{used}->{$lu_name} = 0;
+};
+
+my $make_lun = sub {
+ my ($scfg, $path) = @_;
+
+ die 'Maximum number of LUNs per target is 16383' if scalar @{$SETTINGS->{luns}} >= $MAX_LUNS;
+
+ my $lun = $get_lu_name->();
+ my $conf = {
+ lun => $lun,
+ Path => $path,
+ include => 1,
+ };
+ push @{$SETTINGS->{luns}}, $conf;
+ $SETTINGS->{used}->{$lun} = 1;
+ # print Dumper ($SETTINGS);
+ return $conf;
+};
+
+my $list_view = sub {
+ my ($scfg, $timeout, $method, @params) = @_;
+ my $lun = undef;
+
+ my $object = $params[0];
+ foreach my $lun (@{$SETTINGS->{luns}}) {
+ next unless $lun->{include} == 1;
+ if ($lun->{Path} =~ /^$object$/) {
+ return $lun->{lun} if (defined($lun->{lun}));
+ die "$lun->{Path}: Missing LUN";
+ }
+ }
+
+ return $lun;
+};
+
+my $list_lun = sub {
+ my ($scfg, $timeout, $method, @params) = @_;
+ my $name = undef;
+
+ my $object = $params[0];
+ foreach my $lun (@{$SETTINGS->{luns}}) {
+ next unless $lun->{include} == 1;
+ if ($lun->{Path} =~ /^$object$/) {
+ return $lun->{Path};
+ }
+ }
+ return $name;
+};
+
+my $parse_size = sub {
+ my ($text) = @_;
+
+ return 0 if !$text;
+
+ if ($text =~ m/^(\d+(\.\d+)?)(k)?$/) {
+ my ($size, $reminder, $unit) = ($1, $2, $3);
+ return $size if !$unit;
+ if ($unit eq 'k') {
+ $size *= 1024;
+ }
+ if ($reminder) {
+ $size = ceil($size);
+ }
+ return $size;
+ } else {
+ return 0;
+ }
+};
+
+sub append_group_params {
+ my $scfg = shift;
+ my $params = shift;
+ if ($scfg->{comstar_tg}) {
+ push @{$params}, ('-group', $scfg->{comstar_tg} );
+ }
+}
+
+my $create_lun = sub {
+ my ($scfg, $timeout, $method, @params) = @_;
+
+ if ($list_lun->($scfg, $timeout, $method, @params)) {
+ die "$params[0]: LUN exists";
+ }
+ my $lun = $params[0];
+ $lun = $make_lun->($scfg, $lun);
+
+ my $tid = $get_target_tid->($scfg);
+ my $device = 'diskt'.$tid.'l'.$lun->{lun};
+ print "Create $HANDLER device $device using filename=$lun->{Path}...";
+ my $blocksize = $parse_size->($scfg->{blocksize});
+ my $res = {msg => undef};
+
+
+ my @commands = (
+ "(i=1; while [ ! -e '$lun->{Path}' -a \$i -le 20 ]; do sleep 1; i=\$((i+1)); done)",
+ "[ -e '$lun->{Path}' ]",
+ "$scstadmin");
+ @params = ('-open_dev', $device, '-handler', $HANDLER, '-attributes', "filename=$lun->{Path},nv_cache=1,blocksize=512,thin_provisioned=1,zero_copy=1");
+
+ $res = $execute_command->($scfg, 'ssh', 30, join ('&&', @commands), @params);
+# $res = $execute_command->($scfg, 'ssh', 30, $scstadmin, @params);
+ do {
+ $free_lu_name->($lun->{lun});
+ if ($res->{msg}) {
+ die $res->{msg} ;
+ } else {
+ die 'create_lun: timeout or unknown error! command: '. join ('&&', @commands) . ' ' . join ' ' , @params;
+ }
+ } unless $res->{result};
+
+ print "Done!\n";
+ print "Create LUN $lun->{lun} using the device $device for target $scfg->{target}...";
+
+ @params = ('-add_lun', $lun->{lun}, '-driver', 'iscsi', '-device', $device, '-target', "$scfg->{target}");
+ append_group_params ($scfg, \@params);
+
+ $res = $execute_command->($scfg, 'ssh', $timeout, $scstadmin, @params);
+
+ do {
+ print "Failed!\nRemoving device...";
+ @params = ('-close_dev', $device, '-handler', $HANDLER,'-noprompt');
+ $execute_command->($scfg, 'ssh', $timeout, $scstadmin, @params);
+ print "Done!\n";
+ $free_lu_name->($lun->{lun});
+ $update_config->($scfg);
+ die $res->{msg};
+ } unless $res->{result};
+ print "Done!\n";
+ $update_config->($scfg);
+ return $res->{msg};
+};
+
+my $delete_lun = sub {
+ my ($scfg, $timeout, $method, @params) = @_;
+ my $res = {msg => undef};
+
+ my $path = $params[0];
+
+
+ foreach my $lun (@{$SETTINGS->{luns}}) {
+ if ($lun->{Path} eq $path) {
+
+ my $tid = $get_target_tid->($scfg);
+ my $device = 'diskt'.$tid.'l'.$lun->{lun};
+ print "Delete $HANDLER device $device using filename=$lun->{Path}...";
+
+ @params = ('-rem_lun', $lun->{lun}, '-driver', 'iscsi', '-device', $device, '-target', "$scfg->{target}", '-noprompt');
+ append_group_params ($scfg, \@params);
+
+ $res = $execute_command->($scfg, 'ssh', $timeout, $scstadmin, @params);
+ do {
+ $free_lu_name->($lun->{lun});
+ die $res->{msg};
+ } unless $res->{result};
+
+ print "Done!\n";
+ print "Delete LUN $lun->{lun} using the device $device for target $scfg->{target}...";
+
+ @params = ('-close_dev', $device, '-handler', $HANDLER,'-noprompt');
+ $res = $execute_command->($scfg, 'ssh', $timeout, $scstadmin, @params);
+
+ if ($res->{result}) {
+ $free_lu_name->($lun->{lun});
+ print "Done!\n";
+ last;
+ } else {
+ $update_config->($scfg);
+ die $res->{msg};
+ }
+ }
+ }
+ $update_config->($scfg);
+ return $res->{msg};
+};
+
+my $import_lun = sub {
+ my ($scfg, $timeout, $method, @params) = @_;
+
+ print "Import LUN\n";
+ return $create_lun->($scfg, $timeout, $method, @params);
+};
+
+my $modify_lun = sub {
+ my ($scfg, $timeout, $method, @params) = @_;
+ my $lun;
+ my $res = {msg => undef};
+
+ my $path = $params[1];
+
+ foreach my $cfg (@{$SETTINGS->{luns}}) {
+ if ($cfg->{Path} eq $path) {
+ $lun = $cfg;
+ last;
+ }
+ }
+
+ my $tid = $get_target_tid->($scfg);
+ my $device = 'diskt'.$tid.'l'.$lun->{lun};
+
+
+ @params = ('-resync_dev', $device, '-handler', $HANDLER,'-noprompt');
+ $res = $execute_command->($scfg, 'ssh', $timeout, $scstadmin, @params);
+ die $res->{msg} unless $res->{result};
+
+ $update_config->($scfg);
+ return $res->{msg};
+};
+
+my $add_view = sub {
+ my ($scfg, $timeout, $method, @params) = @_;
+ return '';
+};
+
+my $get_lun_cmd_map = sub {
+ my ($method) = @_;
+
+ my $cmdmap = {
+ create_lu => { cmd => $create_lun },
+ delete_lu => { cmd => $delete_lun },
+ import_lu => { cmd => $import_lun },
+ modify_lu => { cmd => $modify_lun },
+ add_view => { cmd => $add_view },
+ list_view => { cmd => $list_view },
+ list_lu => { cmd => $list_lun },
+ };
+
+ die "unknown command '$method'" unless exists $cmdmap->{$method};
+
+ return $cmdmap->{$method};
+};
+
+sub run_lun_command {
+ my ($scfg, $timeout, $method, @params) = @_;
+
+ $readConfigFile->($scfg) unless $SETTINGS;
+ my $cmdmap = $get_lun_cmd_map->($method);
+ my $msg = $cmdmap->{cmd}->($scfg, $timeout, $method, @params);
+
+ return $msg;
+}
+
+sub get_base {
+ return '/dev/zvol';
+}
+
+1;
+
diff --git a/PVE/Storage/ZFSPlugin.pm b/PVE/Storage/ZFSPlugin.pm
index f88fe94..6694d4e 100644
--- a/PVE/Storage/ZFSPlugin.pm
+++ b/PVE/Storage/ZFSPlugin.pm
@@ -12,9 +12,11 @@ use base qw(PVE::Storage::ZFSPoolPlugin);
use PVE::Storage::LunCmd::Comstar;
use PVE::Storage::LunCmd::Istgt;
use PVE::Storage::LunCmd::Iet;
+use PVE::Storage::LunCmd::Scst;
+use Data::Dumper;


-my @ssh_opts = ('-o', 'BatchMode=yes');
+my @ssh_opts = ('-o', 'BatchMode=yes','-o','PreferredAuthentications=publickey');
my @ssh_cmd = ('/usr/bin/ssh', @ssh_opts);
my $id_rsa_path = '/etc/pve/priv/zfs';

@@ -31,7 +33,7 @@ my $lun_cmds = {
my $zfs_unknown_scsi_provider = sub {
my ($provider) = @_;

- die "$provider: unknown iscsi provider. Available [comstar, istgt, iet]";
+ die "$provider: unknown iscsi provider. Available [comstar, istgt, iet, scst]";
};

my $zfs_get_base = sub {
@@ -43,6 +45,8 @@ my $zfs_get_base = sub {
return PVE::Storage::LunCmd::Istgt::get_base;
} elsif ($scfg->{iscsiprovider} eq 'iet') {
return PVE::Storage::LunCmd::Iet::get_base;
+ } elsif ($scfg->{iscsiprovider} eq 'scst') {
+ return PVE::Storage::LunCmd::Scst::get_base;
} else {
$zfs_unknown_scsi_provider->($scfg->{iscsiprovider});
}
@@ -63,6 +67,8 @@ sub zfs_request {
$msg = PVE::Storage::LunCmd::Istgt::run_lun_command($scfg, $timeout, $method, @params);
} elsif ($scfg->{iscsiprovider} eq 'iet') {
$msg = PVE::Storage::LunCmd::Iet::run_lun_command($scfg, $timeout, $method, @params);
+ } elsif ($scfg->{iscsiprovider} eq 'scst') {
+ $msg = PVE::Storage::LunCmd::Scst::run_lun_command($scfg, $timeout, $method, @params);
} else {
$zfs_unknown_scsi_provider->($scfg->{iscsiprovider});
}
@@ -98,11 +104,13 @@ sub zfs_get_lu_name {

my $object = ($zvol =~ /^.+\/.+/) ? "$base/$zvol" : "$base/$scfg->{pool}/$zvol";

+ print "$object\n";
+
my $lu_name = $class->zfs_request($scfg, undef, 'list_lu', $object);

return $lu_name if $lu_name;

- die "Could not find lu_name for zvol $zvol";
+ die "Could not find lu_name for zvol $zvol: $object";
}

sub zfs_add_lun_mapping_entry {
@@ -351,6 +359,7 @@ sub volume_has_feature {
clone => { base => 1},
template => { current => 1},
copy => { base => 1, current => 1},
+ sparseinit => { base => 1, current => 1},
};

my ($vtype, $name, $vmid, $basename, $basevmid, $isBase) =
--
2.11.0
Dzmitry Kotsikau
2018-05-03 12:50:22 UTC
Permalink
Signed-off-by: Dzmitry Kotsikau <***@gmail.com>
---
PVE/Storage/LunCmd/Scst.pm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/PVE/Storage/LunCmd/Scst.pm b/PVE/Storage/LunCmd/Scst.pm
index 4e0a67b..8ab3f09 100644
--- a/PVE/Storage/LunCmd/Scst.pm
+++ b/PVE/Storage/LunCmd/Scst.pm
@@ -40,7 +40,7 @@ my $HANDLER = 'vdisk_fileio';
my $CONFIG_FILE = '/etc/scst.conf';
my $CONFIG_FILE_TMP = '/tmp/pve-scst.conf';

-my $DAEMON = '/usr/local/sbin/iscsi-scstd';
+my $DAEMON = '/usr/sbin/iscsi-scstd';
my $SETTINGS = undef;
my $CONFIG;

@@ -48,7 +48,7 @@ my @ssh_opts = ('-o', 'BatchMode=yes', '-o','PreferredAuthentications=publickey'
my @ssh_cmd = ('/usr/bin/ssh', @ssh_opts);
my @scp_cmd = ('/usr/bin/scp', @ssh_opts);
my $id_rsa_path = '/etc/pve/priv/zfs';
-my $scstadmin = '/usr/local/sbin/scstadmin';
+my $scstadmin = '/usr/sbin/scstadmin';

my $execute_command = sub {
my ($scfg, $exec, $timeout, $method, @params) = @_;
--
2.11.0
Dietmar Maurer
2018-05-03 13:00:28 UTC
Permalink
Why SCTS (no debian packages)? I guess it would make more sense to use
targetcli, because
there are debian packages for that (targetcli-fb).
Post by Dzmitry Kotsikau
SCTS target can be installed on Proxmox node with ZFS
Alexander Schmid
2018-05-03 13:11:32 UTC
Permalink
dkms packages run fine, and scst is imho the most prferrable target
available.
In special when it comes to ease of management via sysfs and support for
rdma transports like iser and srp.

Also, the target not necessary runs on the PVE host itself but could be
either virualized or on a separate host / san.
Post by Dietmar Maurer
Why SCTS (no debian packages)? I guess it would make more sense to use
targetcli, because
there are debian packages for that (targetcli-fb).
Post by Dzmitry Kotsikau
SCTS target can be installed on Proxmox node with ZFS
_______________________________________________
pve-devel mailing list
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
--
Mit freundlichen Grüßen,
*Alexander Schmid*



*Anschrift:*
Alexander Schmid
Modula Shop Systems
Roßmarkt 2
87700 Memmingen
Germany

Tel: +49 - (0)8331 - 6408716
Mobile: +49 - (0)176 - 23995231
Fax: +49 - (0)8331 - 6400225
Mail: ***@modula-shop-systems.de <mailto:***@modula-shop-systems.de>
Web: www.modula-shop-systems.de <http://www.modula-shop-systems.de>
USt. Id: DE243249493
Dietmar Maurer
2018-05-03 16:34:56 UTC
Permalink
Post by Alexander Schmid
dkms packages run fine, and scst is imho the most prferrable target
available.
DKMS is a PITA

and LIO drivers are include by default.
Post by Alexander Schmid
In special when it comes to ease of management via sysfs and support for
rdma transports like iser and srp.
Also, the target not necessary runs on the PVE host itself but could be
either virualized or on a separate host / san.
Yes, so why not use the iSCSI target included in any Linux distribution?
Alexander Schmid
2018-05-03 17:39:20 UTC
Permalink
Post by Dietmar Maurer
Post by Alexander Schmid
dkms packages run fine, and scst is imho the most prferrable target
available.
DKMS is a PITA
and LIO drivers are include by default.
Post by Alexander Schmid
In special when it comes to ease of management via sysfs and support for
rdma transports like iser and srp.
Also, the target not necessary runs on the PVE host itself but could be
either virualized or on a separate host / san.
Yes, so why not use the iSCSI target included in any Linux distribution?
Is there a need limit users in which target to use (or not not) for
their shared Storage ?
Adding SCST is not going to end up with 10 more targets to support, as
there simply are not so many iscsi target implementations available.

PVE supports Comstar and istgt, where also no Linux packages are available.

Technical aspects/personal preference aside, SCST is not an uncommon
target, so it's worth to at least consider adding it.
There is also ESOS (http://www.esos-project.com/) what is basically SCST
(and ZFS if built with it) that is very stable and really painless to
setup and maintain.
--
Mit freundlichen Grüßen,
*Alexander Schmid*



*Anschrift:*
Alexander Schmid
Modula Shop Systems
Roßmarkt 2
87700 Memmingen
Germany

Tel: +49 - (0)8331 - 6408716
Mobile: +49 - (0)176 - 23995231
Fax: +49 - (0)8331 - 6400225
Mail: ***@modula-shop-systems.de <mailto:***@modula-shop-systems.de>
Web: www.modula-shop-systems.de <http://www.modula-shop-systems.de>
USt. Id: DE243249493
Dietmar Maurer
2018-05-04 07:58:24 UTC
Permalink
Post by Alexander Schmid
Post by Dietmar Maurer
Post by Alexander Schmid
dkms packages run fine, and scst is imho the most prferrable target
available.
DKMS is a PITA
and LIO drivers are include by default.
Post by Alexander Schmid
In special when it comes to ease of management via sysfs and support for
rdma transports like iser and srp.
Also, the target not necessary runs on the PVE host itself but could be
either virualized or on a separate host / san.
Yes, so why not use the iSCSI target included in any Linux distribution?
Is there a need limit users in which target to use (or not not) for
their shared Storage ?
not really
Post by Alexander Schmid
Adding SCST is not going to end up with 10 more targets to support, as
there simply are not so many iscsi target implementations available.
PVE supports Comstar and istgt, where also no Linux packages are available.
Technical aspects/personal preference aside, SCST is not an uncommon
target, so it's worth to at least consider adding it.
There is also ESOS (http://www.esos-project.com/) what is basically SCST
(and ZFS if built with it) that is very stable and really painless to
setup and maintain.
I would simply prefer LIO, because of above advantages.

Дмитрий Котиков
2018-05-03 18:01:07 UTC
Permalink
ISER and srpt are not supported by libiscsi that comes with Proxmox. It
can be built with ISER support, but Debian version comes without it, it is
old one.
Thus qemu is also built with old libiscsi and does not support iSER and
srpt. I tried to switch SCST to iSER and found out that I could not do it
without deployment of the new libiscsi and rebuilding of QEMU stuff.

I tried several years ago to use LIO. My ESXi hosts did not work with it.
Also there were issues with clusters when I tried to use LIO for them.
So the only thing that worked at that time was SCST.

When I had to select LIO or SCST I found out that LIO was renamed to TCM,
and I had no idea what was changed. So SCST was the olny iSCSI target that
worked in my memory.

I also had to ask SCST team to resolve some issues with scstadmin tool to
fix an issue with LUN deletion. There are my e-mails in their dev stream.
Also SCST team added dpkg target to makefile to build deb packages several
months ago.
Only after that I decided to submit SCST patches to Proxmox team. I just
had to re-apply patch after every Proxmox update. It works on my server
alredy for 4 months and I have decided to make things easier. :)

SCST and QEMU have some incompabilities. If block size is not 512 in SCST,
then qemu-img will fail with very odd message. It fails to calculate
correct size of the disk.
So SCST is not ideal (or qemu - I haven't found which one fails and to what
team I should report a defect), but it works at least.

In my understanding, the topic is not why SCST is better/worse than LIO.
The topic is that SCST support is now added in Proxmox somehow, but LIO is
not.
Someone else can try to add LIO support to Proxmox.
Post by Dietmar Maurer
Post by Alexander Schmid
dkms packages run fine, and scst is imho the most prferrable target
available.
DKMS is a PITA
and LIO drivers are include by default
Post by Alexander Schmid
In special when it comes to ease of management via sysfs and support for
rdma transports like iser and srp.
Also, the target not necessary runs on the PVE host itself but could be
either virualized or on a separate host / san
Yes, so why not use the iSCSI target included in any Linux distribution?
_______________________________________________
pve-devel mailing list
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Loading...