From 02931346c64848f784b392477136c2d67d95adfd Mon Sep 17 00:00:00 2001 From: Fiona Ebner Date: Wed, 2 Jul 2025 18:27:40 +0200 Subject: [PATCH] zfs iscsi plugin: implement new method to get qemu blockdevice options Reported-by: Alexandre Derumier Signed-off-by: Fiona Ebner --- src/PVE/Storage/ZFSPlugin.pm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/PVE/Storage/ZFSPlugin.pm b/src/PVE/Storage/ZFSPlugin.pm index f0fa522..c03fcca 100644 --- a/src/PVE/Storage/ZFSPlugin.pm +++ b/src/PVE/Storage/ZFSPlugin.pm @@ -247,6 +247,22 @@ sub path { return ($path, $vmid, $vtype); } +sub qemu_blockdev_options { + my ($class, $scfg, $storeid, $volname) = @_; + + my $name = ($class->parse_volname($volname))[1]; + my $guid = $class->zfs_get_lu_name($scfg, $name); + my $lun = $class->zfs_get_lun_number($scfg, $guid); + + return { + driver => 'iscsi', + transport => 'tcp', + portal => "$scfg->{portal}", + target => "$scfg->{target}", + lun => int($lun), + }; +} + sub create_base { my ($class, $storeid, $scfg, $volname) = @_;