]> git.proxmox.com Git - pve-storage.git/commitdiff
fix #1123: modify NVME device path for SMART support
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Mon, 3 Oct 2016 11:53:37 +0000 (13:53 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 4 Oct 2016 08:35:30 +0000 (10:35 +0200)
seems like we need to drop the namespace part before calling
smartctl.

note that NVME devices require smartmontools >= 6.5

PVE/Diskmanage.pm

index bfec6bbdf7501cf78266697c989796c2e02b2820..36a5b5b7cbac26ea1255143dc902c2a755710a22 100644 (file)
@@ -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) = @_;