]> git.proxmox.com Git - pve-storage.git/blobdiff - PVE/Diskmanage.pm
Diskmanage: extend wearout detection for SAS disk
[pve-storage.git] / PVE / Diskmanage.pm
index 7a0f96305cf26c069d3b0ba6521b266d6414b18d..116a99a8e9037515ce340df21f45c2692ee18168 100644 (file)
@@ -134,8 +134,8 @@ sub get_smart_data {
            } elsif (defined($type) && $type eq 'text') {
                $smartdata->{text} = '' if !defined $smartdata->{text};
                $smartdata->{text} .= "$line\n";
-               # extract wearout from nvme text, allow for decimal values
-               if ($line =~ m/Percentage Used:\s*(\d+(?:\.\d+)?)\%/i) {
+               # extract wearout from nvme/sas text, allow for decimal values
+               if ($line =~ m/Percentage Used(?: endurance indicator)?:\s*(\d+(?:\.\d+)?)\%/i) {
                    $smartdata->{wearout} = 100 - $1;
                }
            } elsif ($line =~ m/SMART Disabled/) {
@@ -502,7 +502,7 @@ sub get_disks {
            die "disks is not a string or array reference\n";
        }
        # we get cciss/c0d0 but need cciss!c0d0
-       map { s|cciss/|cciss!| } @$disks;
+       $_ =~ s|cciss/|cciss!| for @$disks;
 
        $disk_regex = "(?:" . join('|', @$disks) . ")";
     }