mirror of
https://github.com/unraid/webgui.git
synced 2026-04-22 10:08:25 -05:00
Multi cache pools
This commit is contained in:
@@ -36,9 +36,15 @@ function my_clock($time) {
|
||||
function parity_disks($disk) {
|
||||
return $disk['type']=='Parity';
|
||||
}
|
||||
function cache_disks($disk) {
|
||||
return $disk['type']=='Cache';
|
||||
}
|
||||
function active_disks($disk) {
|
||||
return substr($disk['status'],0,7)!='DISK_NP' && in_array($disk['type'],['Parity','Data','Cache']);
|
||||
}
|
||||
function prefix($key) {
|
||||
return preg_replace('/[0-9]+$/','',$key);
|
||||
}
|
||||
function find_day($D) {
|
||||
global $days;
|
||||
if ($days[0] == '*') return $D;
|
||||
@@ -217,9 +223,9 @@ function device_usage(&$disk, $array, &$full, &$high) {
|
||||
return $text%10==0 ? "-" : "<span class='load'>-</span><div class='usage-disk sys none'><span></span></div>";
|
||||
}
|
||||
}
|
||||
function array_group($type) {
|
||||
function array_group($type,$pool=false) {
|
||||
global $disks,$error,$warning,$red,$orange,$fail,$smart,$full,$high;
|
||||
foreach ($disks as $disk) if ($disk['type']==$type && strpos($disk['status'],'DISK_NP')===false) {
|
||||
foreach ($disks as $disk) if ($disk['type']==$type && strpos($disk['status'],'DISK_NP')===false && ($pool==false||$pool==prefix($disk['name']))) {
|
||||
echo "<tr><td></td>";
|
||||
echo "<td>".device_name($disk,true)."</td>";
|
||||
echo "<td>".device_status($disk,true,$error,$warning)."</td>";
|
||||
@@ -266,8 +272,14 @@ case 'cache':
|
||||
require_once "$docroot/webGui/include/CustomMerge.php";
|
||||
require_once "$docroot/webGui/include/Preselect.php";
|
||||
$error = $warning = $red = $orange = $fail = $smart = $full = $high = 0;
|
||||
array_group('Cache');
|
||||
echo "\0".($error+$warning)."\0".($red+$orange)."\0".($fail+$smart)."\0".($full+$high);
|
||||
$cache = array_filter($disks,'cache_disks');
|
||||
$pools = array_unique(array_map('prefix',array_keys($cache)));
|
||||
foreach ($pools as $pool) {
|
||||
if ($cache[$pool]['devicesSb']) {
|
||||
array_group('Cache',$pool);
|
||||
echo "\0".($error+$warning)."\0".($red+$orange)."\0".($fail+$smart)."\0".($full+$high)."\r";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'extra':
|
||||
$path = $_POST['path'];
|
||||
|
||||
@@ -408,7 +408,7 @@ case 'cache':
|
||||
} else {
|
||||
if ($cache[$pool]['devicesSb']) {
|
||||
foreach ($cache as $disk) if (prefix($disk['name'])==$pool) array_online($disk);
|
||||
if ($display['total'] && $var['cacheSbNumDisks']>1) show_totals(sprintf(_('Pool of %s devices'),my_word($cache[$pool]['devicesSb'])),false);
|
||||
if ($display['total'] && $cache[$pool]['devicesSb']) show_totals(sprintf(_('Pool of %s devices'),my_word($cache[$pool]['devicesSb'])),false);
|
||||
echo "\0";
|
||||
}
|
||||
@unlink($tmp);
|
||||
|
||||
Reference in New Issue
Block a user