From: Dietmar Maurer <dietmar@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [RFC pve-storage 06/27] diskmanage: link multipath member disks to their map device
Date: Fri, 31 Jul 2026 12:21:35 +0200 [thread overview]
Message-ID: <20260731102156.3947857-7-dietmar@proxmox.com> (raw)
In-Reply-To: <20260731102156.3947857-1-dietmar@proxmox.com>
Multipath member disks only reported the generic 'Device Mapper'
usage, with no way to tell which map a member belongs to, or that
the device mapper holder is a multipath map at all. Report the
mapped device path in the new multipath property, so clients can
group paths by map or hide members in favor of the mapped device.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
---
src/PVE/API2/Disks.pm | 6 ++++
src/PVE/Diskmanage.pm | 33 +++++++++++++++++++
.../multipath/disklist_expected.json | 12 ++++---
3 files changed, 47 insertions(+), 4 deletions(-)
diff --git a/src/PVE/API2/Disks.pm b/src/PVE/API2/Disks.pm
index ee287f7..2417340 100644
--- a/src/PVE/API2/Disks.pm
+++ b/src/PVE/API2/Disks.pm
@@ -149,6 +149,12 @@ __PACKAGE__->register_method({
. 'example sata, sas, usb, fc, iscsi, nvme, nvme-fc, nvme-tcp).',
optional => 1,
},
+ multipath => {
+ type => 'string',
+ description => 'For multipath member devices only. The mapped '
+ . 'device path of the multipath map the device belongs to.',
+ optional => 1,
+ },
parent => {
type => 'string',
description => 'For partitions only. The device path of '
diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index ed270e9..5ac04dd 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -535,12 +535,42 @@ sub mounted_paths {
return $mounted;
}
+# Maps multipath member devices (e.g. 'sda') to the mapped device path of
+# their multipath map (e.g. '/dev/mapper/mpatha').
+my sub get_multipath_slave_map {
+ my $slave_map = {};
+
+ dir_glob_foreach(
+ '/sys/block',
+ 'dm-\d+',
+ sub {
+ my ($dev) = @_;
+ my $sysdir = "/sys/block/$dev";
+
+ my $uuid = file_read_firstline("$sysdir/dm/uuid") // return;
+ return if $uuid !~ m/^mpath-/;
+
+ my $name = file_read_firstline("$sysdir/dm/name") // return;
+
+ dir_glob_foreach(
+ "$sysdir/slaves",
+ '[^.].*',
+ sub { $slave_map->{ $_[0] } = "/dev/mapper/$name"; },
+ );
+ },
+ );
+
+ return $slave_map;
+}
+
sub get_disks {
my ($disks, $nosmart, $include_partitions) = @_;
my $disklist = {};
my $mounted = mounted_blockdevs();
+ my $mpath_slave_map = get_multipath_slave_map();
+
my $lsblk_info = get_lsblk_info();
my $journalhash = get_ceph_journals($lsblk_info);
@@ -655,6 +685,9 @@ sub get_disks {
$disklist->{$dev}->{transport} = $transport if defined($transport);
$disklist->{$dev}->{mounted} = 1 if exists $mounted->{$devpath};
+ my $mpath = $mpath_slave_map->{$dev};
+ $disklist->{$dev}->{multipath} = $mpath if defined($mpath);
+
my $by_id_link = $data->{by_id_link};
$disklist->{$dev}->{by_id_link} = $by_id_link if defined($by_id_link);
diff --git a/src/test/disk_tests/multipath/disklist_expected.json b/src/test/disk_tests/multipath/disklist_expected.json
index ec44296..001193d 100644
--- a/src/test/disk_tests/multipath/disklist_expected.json
+++ b/src/test/disk_tests/multipath/disklist_expected.json
@@ -15,7 +15,8 @@
"osdid-list": null,
"by_id_link": "/dev/disk/by-id/scsi-36001405000000000000000000000000a",
"transport": "fc",
- "used": "Device Mapper"
+ "used": "Device Mapper",
+ "multipath": "/dev/mapper/mpatha"
},
"sdb": {
"devpath": "/dev/sdb",
@@ -33,7 +34,8 @@
"osdid-list": null,
"by_id_link": "/dev/disk/by-id/scsi-36001405000000000000000000000000b",
"transport": "fc",
- "used": "Device Mapper"
+ "used": "Device Mapper",
+ "multipath": "/dev/mapper/mpatha"
},
"sdc": {
"devpath": "/dev/sdc",
@@ -51,7 +53,8 @@
"osdid-list": null,
"by_id_link": "/dev/disk/by-id/scsi-36001405000000000000000000000000c",
"transport": "fc",
- "used": "Device Mapper"
+ "used": "Device Mapper",
+ "multipath": "/dev/mapper/mpathb"
},
"sdd": {
"devpath": "/dev/sdd",
@@ -69,7 +72,8 @@
"osdid-list": null,
"by_id_link": "/dev/disk/by-id/scsi-36001405000000000000000000000000d",
"transport": "fc",
- "used": "Device Mapper"
+ "used": "Device Mapper",
+ "multipath": "/dev/mapper/mpathb"
},
"nvme8n1": {
"devpath": "/dev/nvme8n1",
--
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 ` [RFC pve-storage 05/27] diskmanage: include iSCSI session devices in disk enumeration Dietmar Maurer
2026-07-31 10:21 ` Dietmar Maurer [this message]
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-7-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.