From 865bdbd9178eb63a4ec3357c1bc4cc36f25d79e1 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Mon, 17 Oct 2016 10:29:11 +0200 Subject: [PATCH] use model from udevadm we want this, because the model in /sys/block//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 --- 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.39.2