diff options
author | Simon Rettberg | 2019-02-12 14:55:49 +0100 |
---|---|---|
committer | Simon Rettberg | 2019-02-12 14:55:49 +0100 |
commit | ec4ac82adaabe55cb9c3c40fad66d3451cb5f4d9 (patch) | |
tree | 0134ad4e33aa259250fb46a82e7da44b091db88e /modules-available/statistics/inc/parser.inc.php | |
parent | [serversetup*] PXELinux and iPXE side-by-side (diff) | |
parent | [inc/Dictionary] Teh evil unvalidated redirects must die! (diff) | |
download | slx-admin-ipxe.tar.gz slx-admin-ipxe.tar.xz slx-admin-ipxe.zip |
Merge branch 'master' into ipxeipxe
Diffstat (limited to 'modules-available/statistics/inc/parser.inc.php')
-rw-r--r-- | modules-available/statistics/inc/parser.inc.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/modules-available/statistics/inc/parser.inc.php b/modules-available/statistics/inc/parser.inc.php index b179b4a3..0d39079d 100644 --- a/modules-available/statistics/inc/parser.inc.php +++ b/modules-available/statistics/inc/parser.inc.php @@ -104,10 +104,12 @@ class Parser { foreach ($lines as $line) { if (preg_match('/^Disk (\S+):.* (\d+) bytes/i', $line, $out)) { // --- Beginning of MBR disk --- + unset($hdd); if ($out[2] < 10000) // sometimes vmware reports lots of 512byte disks continue; + if (substr($out[1], 0, 8) === '/dev/dm-') // Ignore device mapper + continue; // disk total size and name - unset($hdd); $mbrToMbFactor = 0; // This is != 0 for mbr $sectorToMbFactor = 0; // This is != for gpt $hdd = array( @@ -122,10 +124,12 @@ class Parser { $hdds[] = &$hdd; } elseif (preg_match('/^Disk (\S+):\s+(\d+)\s+sectors,/i', $line, $out)) { // --- Beginning of GPT disk --- + unset($hdd); if ($out[2] < 1000) // sometimes vmware reports lots of 512byte disks continue; + if (substr($out[1], 0, 8) === '/dev/dm-') // Ignore device mapper + continue; // disk total size and name - unset($hdd); $mbrToMbFactor = 0; // This is != 0 for mbr $sectorToMbFactor = 0; // This is != for gpt $hdd = array( @@ -213,7 +217,7 @@ class Parser { $hdd['size'] = round(($hdd['sectors'] * $sectorToMbFactor) / 1024); } $free = $hdd['size'] - $hdd['used']; - if ($free > 5 || ($free / $hdd['size']) > 0.1) { + if ($hdd['size'] > 0 && ($free > 5 || ($free / $hdd['size']) > 0.1)) { $hdd['partitions'][] = array( 'id' => 'free-id-' . $i, 'name' => Dictionary::translate('unused'), |