--- /usr/share/perl5/PVE/Storage/ZFSPlugin.pm.orig 2018-06-04 11:59:59.851426278 +0800 +++ /usr/share/perl5/PVE/Storage/ZFSPlugin.pm 2018-06-04 12:04:56.781049166 +0800 @@ -10,6 +10,7 @@ use base qw(PVE::Storage::ZFSPoolPlugin); use PVE::Storage::LunCmd::Comstar; +use PVE::Storage::LunCmd::FreeNAS; use PVE::Storage::LunCmd::Istgt; use PVE::Storage::LunCmd::Iet; @@ -31,7 +32,7 @@ my $zfs_unknown_scsi_provider = sub { my ($provider) = @_; - die "$provider: unknown iscsi provider. Available [comstar, istgt, iet]"; + die "$provider: unknown iscsi provider. Available [comstar, freenas, istgt, iet]"; }; my $zfs_get_base = sub { @@ -39,6 +40,8 @@ if ($scfg->{iscsiprovider} eq 'comstar') { return PVE::Storage::LunCmd::Comstar::get_base; + } elsif ($scfg->{iscsiprovider} eq 'freenas') { + return PVE::Storage::LunCmd::FreeNAS::get_base; } elsif ($scfg->{iscsiprovider} eq 'istgt') { return PVE::Storage::LunCmd::Istgt::get_base; } elsif ($scfg->{iscsiprovider} eq 'iet') { @@ -59,6 +62,8 @@ if ($lun_cmds->{$method}) { if ($scfg->{iscsiprovider} eq 'comstar') { $msg = PVE::Storage::LunCmd::Comstar::run_lun_command($scfg, $timeout, $method, @params); + } elsif ($scfg->{iscsiprovider} eq 'freenas') { + $msg = PVE::Storage::LunCmd::FreeNAS::run_lun_command($scfg, $timeout, $method, @params); } elsif ($scfg->{iscsiprovider} eq 'istgt') { $msg = PVE::Storage::LunCmd::Istgt::run_lun_command($scfg, $timeout, $method, @params); } elsif ($scfg->{iscsiprovider} eq 'iet') { @@ -173,6 +178,18 @@ description => "iscsi provider", type => 'string', }, + freenas_user => { + description => "FreeNAS API Username", + type => 'string', + }, + freenas_password => { + description => "FreeNAS API Password", + type => 'string', + }, + freenas_use_ssl => { + description => "FreeNAS API access via SSL", + type => 'boolean', + }, # 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 @@ -204,6 +221,9 @@ sparse => { optional => 1 }, comstar_hg => { optional => 1 }, comstar_tg => { optional => 1 }, + freenas_user => { optional => 1 }, + freenas_password => { optional => 1 }, + freenas_use_ssl => { optional => 1 }, content => { optional => 1 }, bwlimit => { optional => 1 }, };