mirror of
https://github.com/unraid/webgui.git
synced 2026-04-24 02:58:57 -05:00
Multi cache pool
This commit is contained in:
@@ -15,14 +15,8 @@ Tag="bullseye"
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
function cache_only($disk) {
|
||||
return $disk['type']=='Cache';
|
||||
}
|
||||
function prefix($key) {
|
||||
return preg_replace('/[0-9]+$/','',$key);
|
||||
}
|
||||
$cache = array_filter($disks,'cache_only');
|
||||
$pools = array_unique(array_map('prefix',array_keys($cache)));
|
||||
$cache = cache_filter($disks);
|
||||
$pools = pools_filter($cache);
|
||||
$i = 0;
|
||||
?>
|
||||
<link type="text/css" rel="stylesheet" href="<?autov("/webGui/styles/jquery.ui.css")?>">
|
||||
|
||||
@@ -34,15 +34,6 @@ function export_settings($protocol,$share) {
|
||||
if ($share['export']=='e') return _(ucfirst($share['security']));
|
||||
return '<em>'._(ucfirst($share['security'])).'</em>';
|
||||
}
|
||||
function data_devices($disk) {
|
||||
return $disk['type']=='Data';
|
||||
}
|
||||
function cache_devices($disk) {
|
||||
return $disk['type']=='Cache';
|
||||
}
|
||||
function prefix($key) {
|
||||
return preg_replace('/[0-9]+$/','',$key);
|
||||
}
|
||||
function vpn_peers($file) {
|
||||
$peers = [];
|
||||
$entries = array_filter(array_map('trim',preg_split('/\[(Interface|Peer)\]/',file_get_contents($file))));
|
||||
@@ -73,8 +64,8 @@ $mover = file_exists('/var/run/mover.pid');
|
||||
$btrfs = exec('pgrep -cf /sbin/btrfs');
|
||||
$dot = $display['number'][0];
|
||||
|
||||
$cache = array_filter($disks,'cache_devices');
|
||||
$pools = array_unique(array_map('prefix',array_keys($cache)));
|
||||
$cache = cache_filter($disks);
|
||||
$pools = pools_filter($cache);
|
||||
|
||||
foreach ($disks as $disk) {
|
||||
switch ($disk['type']) {
|
||||
|
||||
@@ -33,18 +33,9 @@ function my_clock($time) {
|
||||
$mins = $time%60;
|
||||
return plus($days,'day',($hour|$mins)==0).plus($hour,'hour',$mins==0).plus($mins,'minute',true);
|
||||
}
|
||||
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;
|
||||
@@ -272,8 +263,8 @@ 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;
|
||||
$cache = array_filter($disks,'cache_disks');
|
||||
$pools = array_unique(array_map('prefix',array_keys($cache)));
|
||||
$cache = cache_filter($disks);
|
||||
$pools = pools_filter($cache);
|
||||
foreach ($pools as $pool) {
|
||||
if ($cache[$pool]['devicesSb']) {
|
||||
array_group('Cache',$pool);
|
||||
@@ -367,7 +358,7 @@ case 'speed':
|
||||
break;
|
||||
case 'status':
|
||||
$var = parse_ini_file("state/var.ini");
|
||||
$disks = array_filter(parse_ini_file('state/disks.ini',true),'parity_disks');
|
||||
$disks = parity_filter(parse_ini_file('state/disks.ini',true));
|
||||
$parity_slots = count($disks);
|
||||
$parity_disabled = $parity_invalid = 0;
|
||||
foreach ($disks as $disk) {
|
||||
|
||||
@@ -163,18 +163,6 @@ function fs_info(&$disk) {
|
||||
function my_diskio($data) {
|
||||
return my_scale($data,$unit,1)." $unit/s";
|
||||
}
|
||||
function parity_only($disk) {
|
||||
return $disk['type']=='Parity';
|
||||
}
|
||||
function data_only($disk) {
|
||||
return $disk['type']=='Data';
|
||||
}
|
||||
function cache_only($disk) {
|
||||
return $disk['type']=='Cache';
|
||||
}
|
||||
function prefix($key) {
|
||||
return preg_replace('/[0-9]+$/','',$key);
|
||||
}
|
||||
function array_offline(&$disk) {
|
||||
global $var, $disks;
|
||||
if (strpos($var['mdState'],'ERROR:')===false) {
|
||||
@@ -357,8 +345,8 @@ function cache_slots($off,$pool,$min,$slots) {
|
||||
$crypto = false;
|
||||
switch ($_POST['device']) {
|
||||
case 'array':
|
||||
$parity = array_filter($disks,'parity_only');
|
||||
$data = array_filter($disks,'data_only');
|
||||
$parity = parity_filter($disks);
|
||||
$data = data_filter($disks);
|
||||
foreach ($data as $disk) $crypto |= $disk['luksState']!=0 || vfs_luks($disk['fsType']);
|
||||
if ($var['fsState']=='Stopped') {
|
||||
foreach ($parity as $disk) array_offline($disk);
|
||||
@@ -389,8 +377,8 @@ case 'flash':
|
||||
echo "</tr>";
|
||||
break;
|
||||
case 'cache':
|
||||
$cache = array_filter($disks,'cache_only');
|
||||
$pools = array_unique(array_map('prefix',array_keys($cache)));
|
||||
$cache = cache_filter($disks);
|
||||
$pools = pools_filter($cache);
|
||||
foreach ($pools as $pool) {
|
||||
$tmp = "/var/tmp/$pool.log.tmp";
|
||||
foreach ($cache as $disk) if (prefix($disk['name'])==$pool) $crypto |= $disk['luksState']!=0 || vfs_luks($disk['fsType']);
|
||||
|
||||
@@ -58,6 +58,30 @@ function my_disk($name) {
|
||||
function my_disks($disk) {
|
||||
return strpos($disk['status'],'_NP')===false;
|
||||
}
|
||||
function prefix($key) {
|
||||
return preg_replace('/[0-9]+$/','',$key);
|
||||
}
|
||||
function parity_only($disk) {
|
||||
return $disk['type']=='Parity';
|
||||
}
|
||||
function data_only($disk) {
|
||||
return $disk['type']=='Data';
|
||||
}
|
||||
function cache_only($disk) {
|
||||
return $disk['type']=='Cache';
|
||||
}
|
||||
function parity_filter($disks) {
|
||||
return array_filter($disks,'parity_only');
|
||||
}
|
||||
function data_filter($disks) {
|
||||
return array_filter($disks,'data_only');
|
||||
}
|
||||
function cache_filter($disks) {
|
||||
return array_filter($disks,'cache_only');
|
||||
}
|
||||
function pools_filter($cache) {
|
||||
return array_unique(array_map('prefix',array_keys($cache)));
|
||||
}
|
||||
function my_id($id) {
|
||||
global $display;
|
||||
$len = strlen($id);
|
||||
|
||||
Reference in New Issue
Block a user