From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 265641FF0C0 for ; Wed, 18 Nov 2026 21:27:08 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 1CDBC216CD; Wed, 18 Nov 2026 21:26:57 +0100 (CET) From: Thomas Lamprecht To: pve-devel@lists.proxmox.com Subject: [PATCH v7 storage 02/43] diskmanage: collect disk transport type from lsblk Date: Wed, 18 Nov 2026 21:25:45 +0100 Message-ID: <20261118202646.3017286-3-t.lamprecht@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261118202646.3017286-1-t.lamprecht@proxmox.com> References: <20261118202646.3017286-1-t.lamprecht@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1795033611153 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.169 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: PVKTQ6SE3UK7HS2GKDOU6KL3JOFCPLTF X-Message-ID-Hash: PVKTQ6SE3UK7HS2GKDOU6KL3JOFCPLTF X-MailFrom: t.lamprecht@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Dietmar Maurer Expose the disk transport, for example sata, sas, usb, fc or nvme, in the disk list. The SAN LUN inventory uses it to tell LUNs that are attached over a SAN from local disks. Signed-off-by: Dietmar Maurer [TL: clarify the transport description] Signed-off-by: Thomas Lamprecht --- src/PVE/API2/Disks.pm | 6 ++++++ src/PVE/Diskmanage.pm | 6 +++++- src/test/disk_tests/sas/disklist_expected.json | 1 + src/test/disk_tests/sas/lsblk | 5 +++++ 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 src/test/disk_tests/sas/lsblk diff --git a/src/PVE/API2/Disks.pm b/src/PVE/API2/Disks.pm index e707a9e9..1abab820 100644 --- a/src/PVE/API2/Disks.pm +++ b/src/PVE/API2/Disks.pm @@ -135,6 +135,12 @@ __PACKAGE__->register_method({ serial => { type => 'string', optional => 1 }, wwn => { type => 'string', optional => 1 }, health => { type => 'string', optional => 1 }, + transport => { + type => 'string', + description => + "The device transport, for example 'sata', 'sas', 'usb', 'fc', or 'nvme'.", + 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 f519f10a..4d66902b 100644 --- a/src/PVE/Diskmanage.pm +++ b/src/PVE/Diskmanage.pm @@ -193,7 +193,7 @@ sub get_smart_data { } sub get_lsblk_info { - my $cmd = [$LSBLK, '--json', '-o', 'path,parttype,fstype']; + my $cmd = [$LSBLK, '--json', '-o', 'path,parttype,fstype,tran']; my $output = ""; eval { run_command($cmd, outfunc => sub { $output .= "$_[0]\n"; }); @@ -210,6 +210,7 @@ sub get_lsblk_info { $_->{path} => { parttype => $_->{parttype}, fstype => $_->{fstype}, + tran => $_->{tran}, } } @{$list} }; @@ -646,6 +647,9 @@ sub get_disks { devpath => $devpath, wearout => $wearout, }; + + my $transport = $lsblk_info->{$devpath}->{tran}; + $disklist->{$dev}->{transport} = $transport if defined($transport); $disklist->{$dev}->{mounted} = 1 if exists $mounted->{$devpath}; my $by_id_link = $data->{by_id_link}; diff --git a/src/test/disk_tests/sas/disklist_expected.json b/src/test/disk_tests/sas/disklist_expected.json index a4a1c4c1..26d0d173 100644 --- a/src/test/disk_tests/sas/disklist_expected.json +++ b/src/test/disk_tests/sas/disklist_expected.json @@ -13,6 +13,7 @@ "size" : 5120000, "serial" : "SER2", "wearout" : "N/A", + "transport" : "sas", "by_id_link" : "/dev/disk/by-id/scsi-00000000000000000" } } diff --git a/src/test/disk_tests/sas/lsblk b/src/test/disk_tests/sas/lsblk new file mode 100644 index 00000000..cae98190 --- /dev/null +++ b/src/test/disk_tests/sas/lsblk @@ -0,0 +1,5 @@ +{ + "blockdevices": [ + {"path":"/dev/sda", "parttype":null, "fstype":null, "tran":"sas"} + ] +}