]> git.proxmox.com Git - pve-storage.git/commitdiff
use model from udevadm
authorDominik Csapak <d.csapak@proxmox.com>
Mon, 17 Oct 2016 08:29:11 +0000 (10:29 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 28 Oct 2016 08:19:40 +0000 (10:19 +0200)
we want this, because the model in /sys/block/<device>/device/model
is limited to 16 characters

and since the model is not always in the udevadm output (nvme),
also read the model from the model file as fallback

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

index ad1a896fec4b9671d0cd0944725085e07a26af5a..c8706b7667a6a3f3f9514c37bf7cbf58086d11da 100644 (file)
@@ -255,6 +255,10 @@ sub get_udev_info {
        $data->{usb} = 1;
     }
 
+    if ($info =~ m/^E: ID_MODEL=(.+)$/m) {
+       $data->{model} = $1;
+    }
+
     $data->{wwn} = 'unknown';
     if ($info =~ m/^E: ID_WWN=(.*)$/m) {
        $data->{wwn} = $1;
@@ -413,7 +417,7 @@ sub get_disks {
 
                if ($type eq 'ssd') {
                    # if we have an ssd we try to get the wearout indicator
-                   my $wearval = get_wear_leveling_info($smartdata->{attributes}, $sysdata->{model});
+                   my $wearval = get_wear_leveling_info($smartdata->{attributes}, $data->{model} || $sysdir->{model});
                    $wearout = $wearval if $wearval;
                }
            };
@@ -429,7 +433,7 @@ sub get_disks {
 
        $disklist->{$dev} = {
            vendor => $sysdata->{vendor},
-           model => $sysdata->{model},
+           model => $data->{model} || $sysdata->{model},
            size => $sysdata->{size},
            serial => $data->{serial},
            gpt => $data->{gpt},