Work should be started though , since the new implementation gives less load and more performance..The new iscsi implementation in FreeBSD does overcome the problems in Istgt but introduces a new shortcoming which make it unsuitable for use in Proxmox. The problem is that it has a hardcoded max number for targets and luns which limits it to support a max of 256 luns (256 disks). See https://forums.freebsd.org/threads/maximum-number-of-iscsi-targets-in-freebsd10.45857/
I disagree, istgt needs a reload of all targets after a change and it performs bad..The developer of ctl will not make the necessary changes so implementing support for ctl is currently pointless.
I think that changed on 10.2 according to: https://www.freebsd.org/releases/10.2R/relnotes.html#storage-geom
Also for 11 http://svnweb.freebsd.org/base?view=revision&revision=278037
I use workaround for the simulation of comstar commands (simple perl script).
#!/usr/local/bin/perl
use strict;
use XML::Simple;
use Getopt::Long;
use Text::ParseWords;
#use Log::Any '$log';
#use Log::Any::Adapter ('File', '/var/log/comstar.log');
my $config = "/etc/ctl.conf";
my $target="iqn.2014-06.org.freebsd:target0";
#$log->info("Start with arguments: @ARGV");
open (P,"/usr/sbin/ctladm devlist -x |")||die "Cannot execute: $!";
my $output = join "", <P>;
close(P);
my $luns = XMLin($output, ForceArray => 1, KeyAttr => { lun=>'id'} );
my $command = shift @ARGV;
if ( $command eq "list-lu" ){
my $key;
print " GUID DATA SIZE SOURCE\n";
print "-------------------------------- ------------------- ----------------\n";
foreach $key(keys %{$luns->{lun}})
{
my @lun = quotewords(",", 0, $luns->{lun}->{$key}->{ctld_name}[0]);
if ($lun[0] eq $target)
{
$luns->{lun}->{$key}->{file}[0] =~ s/dev\/zvol/dev\/zvol\/rdsk/;
print sprintf "%32u %20u %s\n", $key, $luns->{lun}->{$key}->{blocksize}[0]*$luns->{lun}->{$key}->{size}[0], $luns->{lun}->{$key}->{file}[0];
}
}
}
elsif ( $command eq "list-view" )
{
my $id = shift @ARGV;
$id = shift @ARGV;
my @lun = quotewords(",", 0, $luns->{lun}->{$id}->{ctld_name}[0]);
print "View Entry: 0\n Host group : All\n Target group : All\n";
print " LUN : " . $lun[2] . "\n";
}
elsif ( $command eq "delete-lu" )
{
my $id = shift @ARGV;
my $find=0;
open(IN_CONF,$config);
my @file_content = <IN_CONF>;
close(IN_CONF);
my @lun = quotewords(",", 0, $luns->{lun}->{$id}->{ctld_name}[0]);
open(OUT_CONF,">$config");
foreach (@file_content)
{
if ($_ eq "#PROXMOX\n")
{
$find = 1;
}
if ($_ ne "lun " . $lun[2] . " {path " . "$luns->{lun}->{$id}->{file}[0]" . "}\n" )#|| !$find )
{
print OUT_CONF;
}
}
close(OUT_CONF);
my $command = "/usr/sbin/ctladm remove -b block -l " . $id;
system('service ctld forcereload');
}
elsif ( $command eq "create-lu" || $command eq "import-lu" )
{
my $filepath = shift @ARGV;
if ( $command eq "create-lu" )
{
$filepath = shift @ARGV;
$filepath = shift @ARGV;
$filepath = shift @ARGV;
$filepath = shift @ARGV;
}
$filepath =~ s/dev\/zvol\/rdsk/dev\/zvol/;
my $key;
my $lun_id=0;
my $find;
my @lun;
while(1)
{
$lun_id = $lun_id + 1;
$find=0;
foreach $key(keys %{$luns->{lun}})
{
@lun = quotewords(",", 0, $luns->{lun}->{$key}->{ctld_name}[0]);
if ( $lun_id == $lun[2] && $lun[0] eq $target )
{
$find=1;
last;
}
}
if ( !$find ) {last;}
};
open(IN_CONF,$config);
my @file_content = <IN_CONF>;
close(IN_CONF);
open(OUT_CONF,">$config");
foreach (@file_content)
{
if ($_ eq "#PROXMOX\n")
{
print OUT_CONF;
print OUT_CONF "lun " . $lun_id . " {path " . $filepath . "}\n";
} else
{
print OUT_CONF;
}
}
close(OUT_CONF);
my $command = "/usr/sbin/ctladm create -b block -o file=" . $filepath . " -o cfiscsi_lun=". $lun_id . " -o cfiscsi_target=". $target;
# system($command);
system('service ctld forcereload');
}
elsif ( $command eq "modify-lu" )
{
my $size = shift @ARGV;
$size = shift @ARGV;
my $id = shift @ARGV;
my $command = "/usr/sbin/ctladm modify -b block -l " . $id . " -s ". $size;
system($command);
}
target iqn.2014-06.org.freebsd:target0 {
auth-group no-authentication
portal-group pg0
lun 0 {path ....}
#PROXMOX
lun 1 {path /dev/zvol/tunk/vmvols/vm-110-disk-1}
}
We use essential cookies to make this site work, and optional cookies to enhance your experience.