diff options
author | Simon Rettberg | 2024-09-19 15:50:21 +0200 |
---|---|---|
committer | Simon Rettberg | 2024-09-19 15:50:21 +0200 |
commit | ef34c64097116939c40724a35bc5fb4025440e64 (patch) | |
tree | ec0860380c3767989286cf2ec017b9226402959d /modules-available | |
parent | [statistics] Update VMware 12.5.x hint as current releases ship it again (diff) | |
download | slx-admin-ef34c64097116939c40724a35bc5fb4025440e64.tar.gz slx-admin-ef34c64097116939c40724a35bc5fb4025440e64.tar.xz slx-admin-ef34c64097116939c40724a35bc5fb4025440e64.zip |
[statistics] Ignore HDDS (block devices) that are too small
Diffstat (limited to 'modules-available')
-rw-r--r-- | modules-available/statistics/inc/hardwareparser.inc.php | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/modules-available/statistics/inc/hardwareparser.inc.php b/modules-available/statistics/inc/hardwareparser.inc.php index 428f7d55..fb8060e8 100644 --- a/modules-available/statistics/inc/hardwareparser.inc.php +++ b/modules-available/statistics/inc/hardwareparser.inc.php @@ -515,6 +515,8 @@ class HardwareParser $smart['rotation_rate'] = 0; } $size = $lsblk['size'] ?? $smart['user_capacity']['bytes'] ?? -1; + if ($size !== -1 && $size < 256000000) + continue; // Ignore too small // Don't change the global props, it would change the HW ID $hwid = self::writeGlobalHardwareData(HardwareInfo::HDD, [ // Try to use the model name as the unique identifier @@ -614,7 +616,7 @@ class HardwareParser ++$i; } } - $table['unused'] = $size - $used; + $table['unused'] = max(0, $size - $used); $table['dev'] = $dev['readlink']; $table += self::propsFromArray($smart + $lsblk, 'serial_number', 'firmware_version', |