use PVE::Storage::LunCmd::Comstar;
use PVE::Storage::LunCmd::Istgt;
use PVE::Storage::LunCmd::Iet;
+use PVE::Storage::LunCmd::LIO;
my @ssh_opts = ('-o', 'BatchMode=yes');
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, LIO]";
};
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 'LIO') {
+ return PVE::Storage::LunCmd::LIO::get_base;
} else {
$zfs_unknown_scsi_provider->($scfg->{iscsiprovider});
}
$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 'LIO') {
+ $msg = PVE::Storage::LunCmd::LIO::run_lun_command($scfg, $timeout, $method, @params);
} else {
$zfs_unknown_scsi_provider->($scfg->{iscsiprovider});
}
my $base = $zfs_get_base->($scfg);
+ $zvol = ($class->parse_volname($zvol))[1];
+
my $object = ($zvol =~ /^.+\/.+/) ? "$base/$zvol" : "$base/$scfg->{pool}/$zvol";
my $lu_name = $class->zfs_request($scfg, undef, 'list_lu', $object);
die "could not find lun_number for guid $guid" if !$guid;
- return $class->zfs_request($scfg, undef, 'list_view', $guid);
+ if ($class->zfs_request($scfg, undef, 'list_view', $guid) =~ /^(\d+)$/) {
+ return $1;
+ }
+
+ die "lun_number for guid $guid is not a number";
}
# Configuration
description => "host group for comstar views",
type => 'string',
},
+ lio_tpg => {
+ description => "target portal group for Linux LIO targets",
+ type => 'string',
+ },
};
}
sparse => { optional => 1 },
comstar_hg => { optional => 1 },
comstar_tg => { optional => 1 },
+ lio_tpg => { optional => 1 },
content => { optional => 1 },
+ bwlimit => { optional => 1 },
};
}
die "unsupported format '$fmt'" if $fmt ne 'raw';
- die "illegal name '$name' - sould be 'vm-$vmid-*'\n"
+ die "illegal name '$name' - should be 'vm-$vmid-*'\n"
if $name && $name !~ m/^vm-$vmid-/;
my $volname = $name;
- $volname = $class->zfs_find_free_diskname($storeid, $scfg, $vmid, $fmt) if !$volname;
+ $volname = $class->find_free_diskname($storeid, $scfg, $vmid, $fmt) if !$volname;
$class->zfs_create_zvol($scfg, $volname, $size);
sub volume_resize {
my ($class, $scfg, $storeid, $volname, $size, $running) = @_;
-
+
+ $volname = ($class->parse_volname($volname))[1];
+
my $new_size = $class->SUPER::volume_resize($scfg, $storeid, $volname, $size, $running);
$class->zfs_resize_lu($scfg, $volname, $new_size);
sub volume_snapshot_delete {
my ($class, $scfg, $storeid, $volname, $snap, $running) = @_;
+ $volname = ($class->parse_volname($volname))[1];
+
$class->zfs_request($scfg, undef, 'destroy', "$scfg->{pool}/$volname\@$snap");
}
sub volume_snapshot_rollback {
my ($class, $scfg, $storeid, $volname, $snap) = @_;
+ $volname = ($class->parse_volname($volname))[1];
+
$class->zfs_delete_lu($scfg, $volname);
$class->zfs_request($scfg, undef, 'rollback', "$scfg->{pool}/$volname\@$snap");
$class->zfs_add_lun_mapping_entry($scfg, $volname);
}
+sub storage_can_replicate {
+ my ($class, $scfg, $storeid, $format) = @_;
+
+ return 0;
+}
+
sub volume_has_feature {
my ($class, $scfg, $feature, $storeid, $volname, $snapname, $running) = @_;
return undef;
}
-sub volume_snapshot_list {
- my ($class, $scfg, $storeid, $volname, $prefix, $ip) = @_;
- # return an empty array if dataset does not exist.
- die "Volume_snapshot_list is not implemented for ZFS over iSCSI.\n";
-}
-
sub activate_storage {
my ($class, $storeid, $scfg, $cache) = @_;