[pve-devel] [PATCH storage 1/3] catch '---' in threshold output of sandisk ssds

Dominik Csapak d.csapak at proxmox.com
Tue Nov 29 16:22:39 CET 2016


sandisk ssds have a default threshold of '---' on nearly all fields,
which prevents our parsing

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/Diskmanage.pm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/PVE/Diskmanage.pm b/PVE/Diskmanage.pm
index 938d6a4..abd9ca9 100644
--- a/PVE/Diskmanage.pm
+++ b/PVE/Diskmanage.pm
@@ -97,14 +97,15 @@ 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;
+		$entry->{threshold} = $6 if defined $6 && $6 eq '---';
+		$entry->{threshold} = $6+0 if defined $6 && !defined($entry->{threshold});
 		$entry->{fail} = $7 if defined $7;
 		$entry->{raw} = $8 if defined $8;
 		$entry->{id} = $1 if defined $1;
-- 
2.1.4





More information about the pve-devel mailing list