]> git.proxmox.com Git - pve-storage.git/commitdiff
disk manage: pass full NVMe device path to smartctl
authorFiona Ebner <f.ebner@proxmox.com>
Mon, 12 Dec 2022 12:33:09 +0000 (13:33 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 13 Dec 2022 12:26:53 +0000 (13:26 +0100)
This essentially reverts commit c9bd3d2 ("fix #1123: modify NVME
device path for SMART support").

The man page for smartctl states
> Use the forms "/dev/nvme[0-9]" (broadcast namespace) or
> "/dev/nvme[0-9]n[1-9]" (specific  namespace 1-9) for NVMe devices.
so it should be fine to pass the path with the specific namespace to
smartctl.

But that text was already present in the man page of version 6.5,
which is the version the commit c9bd3d2 talks about. It might be that
it was necessary to drop the specific namespace for the version
backported from Stretch to Jessie (the bug report mentions that that
version was used[0]), but it's not quite clear.

With current versions, passing in the path with the specific namespace
did work as expected[1], even on a device with multiple namespaces set
up tested locally. In PBS, the path queried via
udev::Device::from_syspath("/sys/block/{name}") is passed to smartctl
and that also included the specific namespace on the systems I tested
with a short script.

So pass the full path to make things a little bit simpler and to avoid
potential future issues like bug #2020[2].

[0]: https://bugzilla.proxmox.com/show_bug.cgi?id=1123#c3
[1]: https://forum.proxmox.com/threads/113962/post-493185
[2]: https://bugzilla.proxmox.com/show_bug.cgi?id=2020

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
PVE/Diskmanage.pm
test/disk_tests/nvme_smart/nvme0_smart [deleted file]
test/disk_tests/nvme_smart/nvme0n1_smart [new file with mode: 0644]

index f682e59d65a460b32175548e396c8d9ec373b01b..a311ffd99ec982ef10311966be2bd9164cb405c6 100644 (file)
@@ -93,8 +93,6 @@ sub get_smart_data {
     my $smartdata = {};
     my $type;
 
-    $disk =~ s/n\d+$// if $disk =~ m!^/dev/nvme\d+n\d+$!;
-
     my $cmd = [$SMARTCTL, '-H'];
     push @$cmd, '-A', '-f', 'brief' if !$healthonly;
     push @$cmd, $disk;
diff --git a/test/disk_tests/nvme_smart/nvme0_smart b/test/disk_tests/nvme_smart/nvme0_smart
deleted file mode 100644 (file)
index f371d5b..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.4.19-1-pve] (local build)
-Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org
-
-=== START OF SMART DATA SECTION ===
-SMART overall-health self-assessment test result: PASSED
-
-SMART/Health Information (NVMe Log 0x02, NSID 0xffffffff)
-Critical Warning:                   0x00
-Temperature:                        32 Celsius
-Available Spare:                    100%
-Available Spare Threshold:          10%
-Percentage Used:                    31%
-Data Units Read:                    1,299,288 [665 GB]
-Data Units Written:                 5,592,478 [2.86 TB]
-Host Read Commands:                 30,360,807
-Host Write Commands:                470,356,196
-Controller Busy Time:               12
-Power Cycles:                       98
-Power On Hours:                     687
-Unsafe Shutdowns:                   21
-Media and Data Integrity Errors:    0
-Error Information Log Entries:      0
diff --git a/test/disk_tests/nvme_smart/nvme0n1_smart b/test/disk_tests/nvme_smart/nvme0n1_smart
new file mode 100644 (file)
index 0000000..f371d5b
--- /dev/null
@@ -0,0 +1,22 @@
+smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.4.19-1-pve] (local build)
+Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org
+
+=== START OF SMART DATA SECTION ===
+SMART overall-health self-assessment test result: PASSED
+
+SMART/Health Information (NVMe Log 0x02, NSID 0xffffffff)
+Critical Warning:                   0x00
+Temperature:                        32 Celsius
+Available Spare:                    100%
+Available Spare Threshold:          10%
+Percentage Used:                    31%
+Data Units Read:                    1,299,288 [665 GB]
+Data Units Written:                 5,592,478 [2.86 TB]
+Host Read Commands:                 30,360,807
+Host Write Commands:                470,356,196
+Controller Busy Time:               12
+Power Cycles:                       98
+Power On Hours:                     687
+Unsafe Shutdowns:                   21
+Media and Data Integrity Errors:    0
+Error Information Log Entries:      0