[pve-devel] [RFC storage 2/3] iscsi direct plugin: implement method to get qemu blockdevice options

Fiona Ebner f.ebner at proxmox.com
Fri May 9 16:15:31 CEST 2025


Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---

for me, it fails with
VM 102 qmp command 'blockdev-add' failed - LUN is write protected
but adding as a drive fails. Will need to investigate.

 src/PVE/Storage/ISCSIDirectPlugin.pm | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/PVE/Storage/ISCSIDirectPlugin.pm b/src/PVE/Storage/ISCSIDirectPlugin.pm
index d54dcd8..a6381c2 100644
--- a/src/PVE/Storage/ISCSIDirectPlugin.pm
+++ b/src/PVE/Storage/ISCSIDirectPlugin.pm
@@ -105,6 +105,23 @@ sub path {
     return ($path, $vmid, $vtype);
 }
 
+sub qemu_blockdev_options {
+    my ($class, $scfg, $storeid, $volname, $snapname) = @_;
+
+    die "volume snapshot is not possible on iscsi device\n"
+	if defined($snapname);
+
+    my $lun = ($class->parse_volname($volname))[1];
+
+    return {
+	driver => 'iscsi',
+	transport => 'tcp',
+	portal => "$scfg->{portal}",
+	target => "$scfg->{target}",
+	lun => int($lun),
+    };
+}
+
 sub create_base {
     my ($class, $storeid, $scfg, $volname) = @_;
 
-- 
2.39.5





More information about the pve-devel mailing list