]> git.proxmox.com Git - pve-storage.git/blobdiff - PVE/Diskmanage.pm
drop absolute udevadm path
[pve-storage.git] / PVE / Diskmanage.pm
index 7a0f96305cf26c069d3b0ba6521b266d6414b18d..9f482af036ef4c5d4b21837e1c862aadc4218f23 100644 (file)
@@ -17,7 +17,6 @@ my $ZPOOL = "/sbin/zpool";
 my $SGDISK = "/sbin/sgdisk";
 my $PVS = "/sbin/pvs";
 my $LVS = "/sbin/lvs";
-my $UDEVADM = "/bin/udevadm";
 my $LSBLK = "/bin/lsblk";
 
 sub verify_blockdev_path {
@@ -134,8 +133,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/) {
@@ -312,7 +311,7 @@ sub get_udev_info {
     my $info = "";
     my $data = {};
     eval {
-       run_command([$UDEVADM, 'info', '-p', $dev, '--query', 'all'], outfunc => sub {
+       run_command(['udevadm', 'info', '-p', $dev, '--query', 'all'], outfunc => sub {
            my ($line) = @_;
            $info .= "$line\n";
        });
@@ -502,7 +501,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) . ")";
     }