[pve-devel] [PATCH v2 storage 5/5] fix #1123: modify NVME device path for SMART support

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon Oct 3 13:53:37 CEST 2016


seems like we need to drop the namespace part before calling
smartctl.

note that NVME devices require smartmontools >= 6.5
---
 PVE/Diskmanage.pm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/PVE/Diskmanage.pm b/PVE/Diskmanage.pm
index bfec6bb..36a5b5b 100644
--- a/PVE/Diskmanage.pm
+++ b/PVE/Diskmanage.pm
@@ -77,6 +77,10 @@ sub get_smart_data {
     my $type;
 
     my $returncode = 0;
+
+    $disk =~ s/n\d+$//
+        if $disk =~ m!^/dev/nvme\d+n\d+$!;
+
     eval {
 	$returncode = run_command([$SMARTCTL, '-H', '-A', '-f', 'brief', $disk], noerr => 1, outfunc => sub{
 	    my ($line) = @_;
@@ -134,6 +138,8 @@ sub get_smart_health {
     return "NOT A DEVICE" if !assert_blockdev($disk, 1);
 
     my $message;
+    $disk =~ s/n\d+$//
+        if $disk =~ m!^/dev/nvme\d+n\d+$!;
 
     run_command([$SMARTCTL, '-H', $disk], noerr => 1, outfunc => sub {
 	my ($line) = @_;
-- 
2.1.4





More information about the pve-devel mailing list