Files
webgui/plugins/dynamix/CacheDevices.page
2020-03-21 13:58:26 +01:00

149 lines
5.6 KiB
Plaintext

Menu="Main:2"
Title="Pool Devices"
Tag="bullseye"
Cond="($pool_devices || $var['fsState']=='Stopped')"
---
<?PHP
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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.
*/
?>
<link type="text/css" rel="stylesheet" href="<?autov("/webGui/styles/jquery.ui.css")?>">
<style>
table.divider{margin-top:2px}
</style>
<script>
function addPoolPopup() {
var popup = $('#dialogAddPool');
// Load popup with the template info
popup.html($("#templatePopupPool").html());
// Start Dialog section
popup.dialog({
title: '_(Add Pool)_',
resizable: false,
width: 600,
modal: true,
show : {effect:'fade', duration:250},
hide : {effect:'fade', duration:250},
buttons: {
_(Add)_: function() {
var poolname = $(this).find('input[name="poolName"]').val();
var valid = /^[a-z_][a-z0-9_-]*[a-z_]$/;
var reserved = ['disk','disks','diskp','diskq','diskr','flash','parity','parity2'];
if (reserved.includes(poolname)) {
swal({title:'_(Invalid pool name)_',text:'_(Do not use reserved names)_',type:'error',confirmButtonText:'_(Ok)_'});
} else if (!valid.test(poolname)) {
swal({title:'_(Invalid pool name)_',text:'_(Use lowercase characters only and no ending digits)_',type:'error',confirmButtonText:'_(Ok)_'});
} else if (poolname) {
$(this).find('form').submit();
$(this).dialog('close');
}
},
_(Cancel)_: function() {
$(this).dialog('close');
}
}
});
$(".ui-dialog .ui-dialog-titlebar").addClass('menu');
$(".ui-dialog .ui-dialog-title").css('text-align','center').css('width', "100%");
$(".ui-dialog .ui-dialog-content").css('padding-top','15px').css('vertical-align','bottom');
$(".ui-button-text").css('padding','0px 5px');
}
function pool_status() {
$.post('/webGui/include/DeviceList.php',{path:'<?=$path?>',device:'cache'},function(d) {
if (!d) return;
d = d.split('\0');
for (var i=0,data; data=d[i]; i++) {
if (data) $('#pool_device'+i).html(data); display_diskio();
}
<?if ($var['fsState']=='Started'):?>
timers.pool_status = setTimeout(pool_status,3000);
<?endif;?>
});
}
<?if ($var['fsState']=='Started'):?>
$('#tab2').bind({click:function() {$('i.toggle').show('slow');}});
<?endif;?>
pool_status();
</script>
<?$i = 0?>
<?foreach ($pools as $pool):?>
<?if ($cache[$pool]['devicesSb'] || $var['fsState']=='Stopped'):?>
<table class="disk_status wide<?=$i?' divider':''?>">
<thead><tr><td>_(Device)_</td><td>_(Identification)_</td><td>_(Temp)_.</td><td>_(Reads)_</td><td>_(Writes)_</td><td>_(Errors)_</td><td>_(FS)_</td><td>_(Size)_</td><td>_(Used)_</td><td>_(Free)_</td><td>_(View)_</td></tr></thead>
<tbody id="pool_device<?=$i++?>">
<?foreach ($cache as $disk) if (prefix($disk['name']==$pool)) echo "<tr><td colspan='11'>&nbsp;</td></tr>"?>
</tbody>
</table>
<?endif;?>
<?endforeach;?>
<?if ($var['fsState']=='Stopped'):?>
<input type="button" value="_(Add Pool)_" style="margin:0" onclick="addPoolPopup()">
<div id="dialogAddPool" style="display:none"></div>
<div id="templatePopupPool" style="display:none">
<form markdown="1" method="POST" action="/update.htm" target="progressFrame">
<input type="hidden" name="changeSlots" value="apply">
_(Name)_:
: <input type="text" name="poolName" maxlength="40" value="">
_(Slots)_:
: <select name="poolSlots">
<?for ($n=1; $n<=$var['MAX_CACHESZ']; $n++):?>
<?=mk_option(1,$n,$n)?>
<?endfor;?>
</select>
</form>
</div>
<?endif;?>
:help3
> **Colored Status Indicator** the significance of the color indicator at the beginning of each line in *Pool Devices* is as follows:
>
> <i class='fa fa-circle orb green-orb'></i>Normal operation, device is active.
>
> <i class='fa fa-circle orb grey-orb'></i>Device is in standby mode (spun-down).
>
> <i class='fa fa-square orb blue-orb'></i>New device.
>
> <i class='fa fa-square orb grey-orb'></i>No device present, position is empty.
>
> **Pool Devices** is a single device, or pool of multiple devices, *outside* the Unraid array. It may be exported for network access just
> like an Array device. Being outside the Unraid array results in significantly faster write access.
>
> There are two ways to configure the Pool devices:
>
> 1. As a single device, or
> 2. As a multi-device pool.
>
> When configured as a single device you may format the device using any supported file system (btrfs, reiserfs,
> or xfs). This configuration offers the highest performance, but at the cost of no data protection - if the
> single pool device fails all data contained on it may be lost.
>
> When configured as a multi-device pool, Unraid OS will automatically select *btrfs-raid1* format (for both data
> and meta-data). btrfs permits any number of devices to be added to the pool and each copy of data is guaranteed
> to be written to two different devices. Hence the pool can withstand a single-disk failure without losing data.
>
> When [User Shares](/Settings/ShareSettings) are enabled, user shares may be configured to
> automatically make use of the Pool device in order to
> speed up writes. A special background process called the *mover* can be scheduled to run
> periodically to move user share files off the Cache and onto the Array.
:end
<?if ($var['fsState'] == "Stopped"):?>
<div></div>
:help4
> **Slots** select the number of device slots in your server designated for Cache devices.
:end
<?endif;?>