Merge pull request #190 from bergware/6.4-wip

Improved formatting of iommu groups
This commit is contained in:
Eric Schultz
2017-10-17 08:45:10 -05:00
committed by GitHub
4 changed files with 82 additions and 54 deletions

View File

@@ -14,6 +14,21 @@ Tag="list"
* all copies or substantial portions of the Software.
*/
?>
<style>
table.pre{margin-top:0}
table.pre td:first-child{width:144px}
table tr td{padding:0 0 3px 0;margin:0}
table tr td.thin{line-height:8px;height:8px}
</style>
<script>
$(function(){
$('#t1').load('/webGui/include/SysDevs.php',{table:'t1'});
$('#t2').load('/webGui/include/SysDevs.php',{table:'t2'});
$('#t3').load('/webGui/include/SysDevs.php',{table:'t3'});
$('#t4').load('/webGui/include/SysDevs.php',{table:'t4'});
});
</script>
**PCI Devices and IOMMU Groups**
> This displays a list of IOMMU groups available on your system along with the output of the `lspci` command for each IOMMU group. The numeric identifiers are used to configure PCI pass-through.
@@ -21,30 +36,20 @@ Tag="list"
<?if (strpos(file_get_contents('/proc/cmdline'), 'pcie_acs_override=') !== false):?>
<p class="notice">Warning: Your system has booted with the PCIe ACS Override setting enabled. The below list doesn't not reflect the way IOMMU would naturally group devices. To see natural IOMMU groups for your hardware, go to the <b><a href="/Settings/VMSettings">VM Settings</a></b> page and set the <b>PCIe ACS Override</b> setting to <b>No</b>.</p>
<?endif;?>
<pre><?
$iommu_groups = shell_exec('for iommu_group in $(ls /sys/kernel/iommu_groups/ -1 | sort -n);do echo "IOMMU group $iommu_group"; for device in $(ls -1 "/sys/kernel/iommu_groups/$iommu_group"/devices/); do echo -n $\'\t\';lspci -ns "$device" | awk \'BEGIN{ORS=" "}{ print "["$3"]" }\';lspci -s "$device"; done; done');
if (empty($iommu_groups)) {
$iommu_groups = explode("\n", shell_exec("lspci -n | awk '{ print \"[\"\$3\"]\" }'"));
$i = 0;
foreach (explode("\n", shell_exec("lspci")) as $strDesc) {
$iommu_groups[$i++] .= " $strDesc";
}
$iommu_groups = implode("\n", $iommu_groups);
}
echo $iommu_groups;
?></pre>
<pre><table id='t1' class='pre'><tr><td><i class='fa fa-spinner fa-spin'></i>&nbsp;Please wait... retrieving information!</td></tr></table></pre><br>
**CPU Thread Pairings**
> This displays a list of CPU thread pairings.
<pre><?=preg_replace(['/(\d+)[-,](\d+)/','/(\d+)\b/'], ['$1 / $2','cpu $1'], shell_exec("cat /sys/devices/system/cpu/*/topology/thread_siblings_list | sort -nu"))?></pre>
<pre><table id='t2' class='pre'><tr><td><i class='fa fa-spinner fa-spin'></i>&nbsp;Please wait... retrieving information!</td></tr></table></pre><br>
**USB Devices**
> This displays the output of the `lsusb` command. The numeric identifiers are used to configure PCI pass-through.
<pre><?=shell_exec("lsusb | sort")?></pre>
<pre><table id='t3' class='pre'><tr><td><i class='fa fa-spinner fa-spin'></i>&nbsp;Please wait... retrieving information!</td></tr></table></pre><br>
**SCSI Devices**
@@ -52,5 +57,5 @@ Tag="list"
>
> Note that linux groups ATA, SATA and SAS devices with true SCSI devices.
<pre><?=shell_exec("lsscsi -s")?></pre>
<pre><table id='t4' class='pre'><tr><td><i class='fa fa-spinner fa-spin'></i>&nbsp;Please wait... retrieving information!</td></tr></table></pre>
<input type="button" value="Done" onclick="done()">

View File

@@ -99,7 +99,7 @@ function assignment(&$disk) {
function fs_info(&$disk) {
global $display;
if ($disk['fsStatus']=='-') {
echo "<td colspan='5'></td>";
echo $disk['type']=='Cache' ? "<td>".str_replace('luks:','',$disk['fsType'])."</td><td colspan='3'>Device is part of cache pool</td><td></td>" : "<td colspan='5'></td>";
return;
} elseif ($disk['fsStatus']=='Mounted') {
echo "<td>".str_replace('luks:','',$disk['fsType'])."</td>";

View File

@@ -0,0 +1,61 @@
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
?>
<?
switch ($_POST['table']) {
case 't1':
exec('for group in $(ls /sys/kernel/iommu_groups/ -1|sort -n);do echo "IOMMU group $group";for device in $(ls -1 "/sys/kernel/iommu_groups/$group"/devices/);do echo -n $\'\t\';lspci -ns "$device"|awk \'BEGIN{ORS=" "}{print "["$3"]"}\';lspci -s "$device";done;done',$groups);
if (empty($groups)) {
exec('lspci -n|awk \'{print "["$3"]"}\'',$iommu);
exec('lspci',$lspci);
$i = 0;
foreach ($lspci as $line) echo "<tr><td>".$iommu[$i++]."</td><td>$line</td></tr>";
} else {
foreach ($groups as $line) {
if (!$line) continue;
if ($line[0]=='I') {
if ($spacer) echo "<tr><td colspan='2' class='thin'></td>"; else $spacer = true;
echo "</tr><tr><td>$line:</td><td>";
$append = true;
} else {
echo preg_replace("/^\t/",$append?"":"<tr><td></td><td>",$line)."</td></tr>";
$append = false;
}
}
}
break;
case 't2':
exec('cat /sys/devices/system/cpu/*/topology/thread_siblings_list|sort -nu',$pairs);
$i = 1;
foreach ($pairs as $line) {
if (!$line) continue;
$line = preg_replace(['/(\d+)[-,](\d+)/','/(\d+)\b/'],['$1 / $2','cpu $1'],$line);
echo "<tr><td>".(strpos($line,'/')===false?"Single":"Pair ".$i++).":</td><td>$line</td></tr>";
}
break;
case 't3':
exec('lsusb|sort',$lsusb);
foreach ($lsusb as $line) {
if (!$line) continue;
list($bus,$id) = explode(':', $line, 2);
echo "<tr><td>$bus:</td><td>".trim($id)."</td></tr>";
}
break;
case 't4':
exec('lsscsi -s',$lsscsi);
foreach ($lsscsi as $line) {
if (!$line || strpos($line,'/dev/')===false) continue;
echo "<tr><td>".preg_replace('/\] +/',']</td><td>',$line)."</td></tr>";
}
break;
}
?>

View File

@@ -1,38 +0,0 @@
<?PHP
/* Copyright 2005-2016, Lime Technology
* Copyright 2012-2016, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
?>
<?
$var = parse_ini_file("state/var.ini");
switch ($var['fsState']) {
case 'Stopped':
echo '<span class="red strong">Array Stopped</span>'; break;
case 'Starting':
echo '<span class="orange strong">Array Starting</span>'; break;
default:
echo '<span class="green strong">Array Started</span>'; break;
}
if ($var['mdResync']) {
$mode = '';
if (strstr($var['mdResyncAction'],"recon")) {
$mode = 'Parity-Sync / Data-Rebuild';
} elseif (strstr($var['mdResyncAction'],"clear")) {
$mode = 'Clearing';
} elseif ($var['mdResyncAction']=="check") {
$mode = 'Read-Check';
} elseif (strstr($var['mdResyncAction'],"check")) {
$mode = 'Parity-Check';
}
echo '&bullet;<span class="orange strong">'.$mode.' '.number_format(($var['mdResyncPos']/($var['mdResync']/100+1)),1,$_POST['dot'],'').' %</span>';
if ($_POST['mode']<0) echo '#stop';
}
?>