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 56D6B1FF0AF for ; Fri, 06 Nov 2026 01:51:01 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 4F84F2176C; Fri, 06 Nov 2026 01:50:02 +0100 (CET) From: Thomas Lamprecht To: pve-devel@lists.proxmox.com Subject: [PATCH v3 storage 12/76] diskmanage: collect disk transport type from lsblk Date: Fri, 6 Nov 2026 00:30:47 +0100 Message-ID: <20261105233336.2178064-13-t.lamprecht@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261105233336.2178064-1-t.lamprecht@proxmox.com> References: <20261105233336.2178064-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: 1793926178057 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.339 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: W6LYW2EJ6QW2XY6VY7ET5N3QYBN4TVBU X-Message-ID-Hash: W6LYW2EJ6QW2XY6VY7ET5N3QYBN4TVBU 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 (sata, sas, fc, nvme, usb) so the storage wizard can distinguish SAN transports when listing candidates for shared LVM. 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..f448f8bd 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', 'fc', 'nvme', or 'usb'.", + 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 4185d2f7..92913d34 100644 --- a/src/PVE/Diskmanage.pm +++ b/src/PVE/Diskmanage.pm @@ -190,7 +190,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"; }); @@ -207,6 +207,7 @@ sub get_lsblk_info { $_->{path} => { parttype => $_->{parttype}, fstype => $_->{fstype}, + tran => $_->{tran}, } } @{$list} }; @@ -643,6 +644,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"} + ] +} -- 2.47.3