]> git.proxmox.com Git - pve-storage.git/commitdiff
catch '---' in threshold output of sandisk ssds
authorDominik Csapak <d.csapak@proxmox.com>
Wed, 30 Nov 2016 15:35:59 +0000 (16:35 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 30 Nov 2016 16:19:43 +0000 (17:19 +0100)
sandisk ssds have a default threshold of '---' on nearly all fields,
which prevents our parsing

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
PVE/Diskmanage.pm

index 938d6a420fc4d8494e8a768748c19c6b7565655c..3433874ecffe805626667094a9b3eedbb5c50643 100644 (file)
@@ -97,14 +97,21 @@ sub get_smart_data {
 # Data Units Written:                 5,584,952 [2.85 TB]
 # Accumulated start-stop cycles:  34
 
-           if (defined($type) && $type eq 'ata' && $line =~ m/^([ \d]{2}\d)\s+(\S+)\s+(\S{6})\s+(\d+)\s+(\d+)\s+(\d+)\s+(\S+)\s+(.*)$/) {
+           if (defined($type) && $type eq 'ata' && $line =~ m/^([ \d]{2}\d)\s+(\S+)\s+(\S{6})\s+(\d+)\s+(\d+)\s+(\S+)\s+(\S+)\s+(.*)$/) {
                my $entry = {};
+
+
                $entry->{name} = $2 if defined $2;
                $entry->{flags} = $3 if defined $3;
                # the +0 makes a number out of the strings
                $entry->{value} = $4+0 if defined $4;
                $entry->{worst} = $5+0 if defined $5;
-               $entry->{threshold} = $6+0 if defined $6;
+               # some disks report the default threshold as --- instead of 000
+               if (defined($6) && $6 eq '---') {
+                   $entry->{threshold} = 0;
+               } else {
+                   $entry->{threshold} = $6+0 if defined $6;
+               }
                $entry->{fail} = $7 if defined $7;
                $entry->{raw} = $8 if defined $8;
                $entry->{id} = $1 if defined $1;