From: Dietmar Maurer <dietmar@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [RFC pve-storage 05/27] diskmanage: include iSCSI session devices in disk enumeration
Date: Fri, 31 Jul 2026 12:21:34 +0200 [thread overview]
Message-ID: <20260731102156.3947857-6-dietmar@proxmox.com> (raw)
In-Reply-To: <20260731102156.3947857-1-dietmar@proxmox.com>
iSCSI attached disks were excluded from disk enumeration since
forever, which made them invisible to every API client, so tooling
working with SAN LUNs, like the SAN LUN scan, could not see them at
all.
Enumerate them instead. The transport property reports 'iscsi', so
the disk list keeps hiding them unless include-remote is set, while
clients wanting the full picture can filter on their own. This also
turns iSCSI LUNs into valid targets for volume group creation via
the disks API, as used for shared LVM on iSCSI setups.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
---
src/PVE/API2/Disks.pm | 4 ++--
src/PVE/Diskmanage.pm | 13 ------------
src/test/disk_tests/iscsi/disklist | 1 +
.../disk_tests/iscsi/disklist_expected.json | 19 +++++++++++++++++
src/test/disk_tests/iscsi/lsblk | 5 +++++
src/test/disk_tests/iscsi/sda/device/model | 1 +
src/test/disk_tests/iscsi/sda/device/vendor | 1 +
.../disk_tests/iscsi/sda/queue/rotational | 1 +
src/test/disk_tests/iscsi/sda/size | 1 +
src/test/disk_tests/iscsi/sda_udevadm | 21 +++++++++++++++++++
src/test/disklist_test.pm | 6 ------
11 files changed, 52 insertions(+), 21 deletions(-)
create mode 100644 src/test/disk_tests/iscsi/disklist
create mode 100644 src/test/disk_tests/iscsi/disklist_expected.json
create mode 100644 src/test/disk_tests/iscsi/lsblk
create mode 100644 src/test/disk_tests/iscsi/sda/device/model
create mode 100644 src/test/disk_tests/iscsi/sda/device/vendor
create mode 100644 src/test/disk_tests/iscsi/sda/queue/rotational
create mode 100644 src/test/disk_tests/iscsi/sda/size
create mode 100644 src/test/disk_tests/iscsi/sda_udevadm
diff --git a/src/PVE/API2/Disks.pm b/src/PVE/API2/Disks.pm
index 673bbcb..ee287f7 100644
--- a/src/PVE/API2/Disks.pm
+++ b/src/PVE/API2/Disks.pm
@@ -145,8 +145,8 @@ __PACKAGE__->register_method({
health => { type => 'string', optional => 1 },
transport => {
type => 'string',
- description => 'The bus type the disk is attached with '
- . '(for example sata, sas, fc, nvme, usb).',
+ description => 'The bus type the disk is attached with (for '
+ . 'example sata, sas, usb, fc, iscsi, nvme, nvme-fc, nvme-tcp).',
optional => 1,
},
parent => {
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index 7ab8119..ed270e9 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -475,16 +475,6 @@ sub dir_is_empty {
return 1;
}
-sub is_iscsi {
- my ($sysdir) = @_;
-
- if (-l $sysdir && readlink($sysdir) =~ m|host[^/]*/session[^/]*|) {
- return 1;
- }
-
- return 0;
-}
-
# Returns the NVMe transport (pcie, fc, tcp, rdma, loop) of a namespace, either directly from
# its controller, or from any controller of its subsystem for native NVMe multipath setups.
sub get_nvme_transport {
@@ -603,9 +593,6 @@ sub get_disks {
my $sysdir = "/sys/block/$dev";
- # we do not want iscsi devices
- return if is_iscsi($sysdir);
-
my $nvme_transport;
$nvme_transport = get_nvme_transport($sysdir) if $dev =~ m/^nvme/;
diff --git a/src/test/disk_tests/iscsi/disklist b/src/test/disk_tests/iscsi/disklist
new file mode 100644
index 0000000..9191c61
--- /dev/null
+++ b/src/test/disk_tests/iscsi/disklist
@@ -0,0 +1 @@
+sda
diff --git a/src/test/disk_tests/iscsi/disklist_expected.json b/src/test/disk_tests/iscsi/disklist_expected.json
new file mode 100644
index 0000000..ca33410
--- /dev/null
+++ b/src/test/disk_tests/iscsi/disklist_expected.json
@@ -0,0 +1,19 @@
+{
+ "sda": {
+ "devpath": "/dev/sda",
+ "size": 10737418240,
+ "vendor": "LIO-ORG",
+ "model": "vdisk1",
+ "serial": "ISER1",
+ "wwn": "0x60014051111111111",
+ "gpt": 0,
+ "rpm": -1,
+ "type": "unknown",
+ "health": "UNKNOWN",
+ "wearout": "N/A",
+ "osdid": -1,
+ "osdid-list": null,
+ "by_id_link": "/dev/disk/by-id/scsi-360014051111111111",
+ "transport": "iscsi"
+ }
+}
diff --git a/src/test/disk_tests/iscsi/lsblk b/src/test/disk_tests/iscsi/lsblk
new file mode 100644
index 0000000..526d27c
--- /dev/null
+++ b/src/test/disk_tests/iscsi/lsblk
@@ -0,0 +1,5 @@
+{
+ "blockdevices": [
+ {"path":"/dev/sda", "parttype":null, "fstype":null, "tran":"iscsi"}
+ ]
+}
diff --git a/src/test/disk_tests/iscsi/sda/device/model b/src/test/disk_tests/iscsi/sda/device/model
new file mode 100644
index 0000000..b14d6fe
--- /dev/null
+++ b/src/test/disk_tests/iscsi/sda/device/model
@@ -0,0 +1 @@
+vdisk1
diff --git a/src/test/disk_tests/iscsi/sda/device/vendor b/src/test/disk_tests/iscsi/sda/device/vendor
new file mode 100644
index 0000000..968831c
--- /dev/null
+++ b/src/test/disk_tests/iscsi/sda/device/vendor
@@ -0,0 +1 @@
+LIO-ORG
diff --git a/src/test/disk_tests/iscsi/sda/queue/rotational b/src/test/disk_tests/iscsi/sda/queue/rotational
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/src/test/disk_tests/iscsi/sda/queue/rotational
@@ -0,0 +1 @@
+1
diff --git a/src/test/disk_tests/iscsi/sda/size b/src/test/disk_tests/iscsi/sda/size
new file mode 100644
index 0000000..14faeec
--- /dev/null
+++ b/src/test/disk_tests/iscsi/sda/size
@@ -0,0 +1 @@
+20971520
diff --git a/src/test/disk_tests/iscsi/sda_udevadm b/src/test/disk_tests/iscsi/sda_udevadm
new file mode 100644
index 0000000..ca9f781
--- /dev/null
+++ b/src/test/disk_tests/iscsi/sda_udevadm
@@ -0,0 +1,21 @@
+P: /devices/platform/host5/session1/target5:0:0/5:0:0:0/block/sda
+N: sda
+S: disk/by-id/scsi-360014051111111111
+S: disk/by-id/wwn-0x60014051111111111
+S: disk/by-path/ip-192.168.1.10:3260-iscsi-iqn.2003-01.org.linux-iscsi.storage:target1-lun-0
+E: DEVLINKS=/dev/disk/by-id/scsi-360014051111111111 /dev/disk/by-id/wwn-0x60014051111111111 /dev/disk/by-path/ip-192.168.1.10:3260-iscsi-iqn.2003-01.org.linux-iscsi.storage:target1-lun-0
+E: DEVNAME=/dev/sda
+E: DEVPATH=/devices/platform/host5/session1/target5:0:0/5:0:0:0/block/sda
+E: DEVTYPE=disk
+E: ID_BUS=scsi
+E: ID_MODEL=vdisk1
+E: ID_PATH=ip-192.168.1.10:3260-iscsi-iqn.2003-01.org.linux-iscsi.storage:target1-lun-0
+E: ID_SCSI=1
+E: ID_SERIAL=36001405111111111
+E: ID_SERIAL_SHORT=ISER1
+E: ID_TYPE=disk
+E: ID_VENDOR=LIO-ORG
+E: ID_WWN=0x60014051111111111
+E: MAJOR=8
+E: MINOR=0
+E: SUBSYSTEM=block
diff --git a/src/test/disklist_test.pm b/src/test/disklist_test.pm
index 9e35430..dc84510 100644
--- a/src/test/disklist_test.pm
+++ b/src/test/disklist_test.pm
@@ -105,10 +105,6 @@ sub mocked_get_sysdir_size {
return &$originalsub($param);
}
-sub mocked_is_iscsi {
- return 0;
-}
-
sub mocked_file_read_firstline {
my ($path) = @_;
@@ -262,8 +258,6 @@ $diskmanage_module->mock('get_sysdir_info' => \&mocked_get_sysdir_info);
print("\tMocked get_sysdir_info\n");
$diskmanage_module->mock('get_sysdir_size' => \&mocked_get_sysdir_size);
print("\tMocked get_sysdir_size\n");
-$diskmanage_module->mock('is_iscsi' => \&mocked_is_iscsi);
-print("\tMocked is_iscsi\n");
$diskmanage_module->mock('assert_blockdev' => sub { return 1; });
print("\tMocked assert_blockdev\n");
$diskmanage_module->mock(
--
2.47.3
next prev parent reply other threads:[~2026-07-31 10:22 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 10:21 [RFC pve-storage/proxmox-widget-toolkit/pve-manager 00/27] add guided remote storage setup and SAN visibility Dietmar Maurer
2026-07-31 10:21 ` [RFC pve-storage 01/27] diskmanage: collect disk transport type from lsblk Dietmar Maurer
2026-07-31 10:21 ` [RFC pve-storage 02/27] diskmanage: add helper to list multipath devices Dietmar Maurer
2026-07-31 10:21 ` [RFC pve-storage 03/27] diskmanage: qualify NVMe over fabrics transport Dietmar Maurer
2026-07-31 10:21 ` [RFC pve-storage 04/27] disks: list: add include-remote parameter Dietmar Maurer
2026-07-31 10:21 ` Dietmar Maurer [this message]
2026-07-31 10:21 ` [RFC pve-storage 06/27] diskmanage: link multipath member disks to their map device Dietmar Maurer
2026-07-31 10:21 ` [RFC pve-storage 07/27] iscsi: factor out session device map from device list Dietmar Maurer
2026-07-31 10:21 ` [RFC pve-storage 08/27] api: scan: add san-luns method listing SAN LUN candidates Dietmar Maurer
2026-07-31 10:21 ` [RFC pve-storage 09/27] disks: lvm: allow creating volume groups on multipath devices Dietmar Maurer
2026-07-31 10:21 ` [RFC pve-storage 10/27] diskmanage: add helper querying multipath path state Dietmar Maurer
2026-07-31 10:21 ` [RFC pve-storage 11/27] diskmanage: add helper querying NVMe native " Dietmar Maurer
2026-07-31 10:21 ` [RFC pve-storage 12/27] api: scan: san-luns: report " Dietmar Maurer
2026-07-31 10:21 ` [RFC pve-storage 13/27] iscsi plugin: list sessions of all transports and capture transport Dietmar Maurer
2026-07-31 10:21 ` [RFC pve-storage 14/27] api: add node-level iSCSI initiator target and session API Dietmar Maurer
2026-07-31 10:21 ` [RFC proxmox-widget-toolkit 15/27] disk selectors: allow opting into remote devices Dietmar Maurer
2026-07-31 10:21 ` [RFC pve-manager 16/27] ui: storage: allow switching the scan node of the NFS/CIFS scan combos Dietmar Maurer
2026-07-31 10:21 ` [RFC pve-manager 17/27] ui: storage: add guided remote storage wizard with NFS support Dietmar Maurer
2026-07-31 10:21 ` [RFC pve-manager 18/27] ui: storage wizard: add SMB/CIFS support Dietmar Maurer
2026-07-31 10:21 ` [RFC pve-manager 19/27] ui: storage wizard: add iSCSI support Dietmar Maurer
2026-07-31 10:21 ` [RFC pve-manager 20/27] ui: storage wizard: add FC-attached SAN (shared LVM) support Dietmar Maurer
2026-07-31 10:21 ` [RFC pve-manager 21/27] ui: storage wizard: add ZFS over iSCSI support Dietmar Maurer
2026-07-31 10:21 ` [RFC pve-manager 22/27] ui: dc: storage: add remote storage wizard entry to the add menu Dietmar Maurer
2026-07-31 10:21 ` [RFC pve-manager 23/27] ui: node: add SAN LUNs panel Dietmar Maurer
2026-07-31 10:21 ` [RFC pve-manager 24/27] ui: san luns: show multipath path state Dietmar Maurer
2026-07-31 10:21 ` [RFC pve-manager 25/27] api: nodes: add iSCSI initiator API endpoint Dietmar Maurer
2026-07-31 10:21 ` [RFC pve-manager 26/27] pvenode: add iscsi commands Dietmar Maurer
2026-07-31 10:21 ` [RFC pve-manager 27/27] ui: san luns: show iSCSI targets and sessions Dietmar Maurer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260731102156.3947857-6-dietmar@proxmox.com \
--to=dietmar@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.