[pve-devel] [PATCH storage 2/2] fix nvme wearout parsing
Dominik Csapak
d.csapak at proxmox.com
Tue Apr 14 16:17:33 CEST 2020
the '.*' was greedy, also consuming all but one digits of the real percentage
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
PVE/Diskmanage.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/PVE/Diskmanage.pm b/PVE/Diskmanage.pm
index abb90a7..e9036fe 100644
--- a/PVE/Diskmanage.pm
+++ b/PVE/Diskmanage.pm
@@ -134,7 +134,7 @@ sub get_smart_data {
$smartdata->{text} = '' if !defined $smartdata->{text};
$smartdata->{text} .= "$line\n";
# extract wearout from nvme text, allow for decimal values
- if ($line =~ m/Percentage Used:.*(\d+(?:\.\d+)?)\%/i) {
+ if ($line =~ m/Percentage Used:.*?(\d+(?:\.\d+)?)\%/i) {
$smartdata->{wearout} = 100 - $1;
}
} elsif ($line =~ m/SMART Disabled/) {
--
2.20.1
More information about the pve-devel
mailing list