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.csa...@proxmox.com>
---
 PVE/Diskmanage.pm | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/PVE/Diskmanage.pm b/PVE/Diskmanage.pm
index ad1a896..c8706b7 100644
--- a/PVE/Diskmanage.pm
+++ b/PVE/Diskmanage.pm
@@ -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},
-- 
2.1.4


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to