mirror of
https://github.com/unraid/webgui.git
synced 2026-05-25 15:49:38 -05:00
zfs subpool support
This commit is contained in:
@@ -568,8 +568,8 @@ function formatWarning(val) {
|
||||
<tr><td><?status_indicator()?>**_(Stopped)_**. _(Unclean shutdown detected)_.</td><td><input type="button" id="cmdStart" value="_(Start)_" onclick="prepareInput(this.form,this)"></td>
|
||||
<td>**_(Start)_** _(will bring the array on-line)_.</td></tr>
|
||||
<? elseif (missing_cache()):?>
|
||||
<tr><td><?status_indicator()?>**_(Stopped)_**. _(Missing Cache disk)_.</td><td><input type="button" id="cmdStart" value="_(Start)_" onclick="prepareInput(this.form,this)" disabled></td>
|
||||
<td>**_(Start)_** _(will remove the missing cache disk and then bring the array on-line)_.
|
||||
<tr><td><?status_indicator()?>**_(Stopped)_**. _(Missing pool disk)_.</td><td><input type="button" id="cmdStart" value="_(Start)_" onclick="prepareInput(this.form,this)" disabled></td>
|
||||
<td>**_(Start)_** _(will remove the missing pool disk and then bring the array on-line)_.
|
||||
<br><input type="checkbox" name="confirmStart" value="OFF" onclick="$('#cmdStart').prop('disabled',!arrayOps.confirmStart.checked)"><small>_(Yes, I want to do this)_</small></td></tr>
|
||||
<? else:?>
|
||||
<tr><td><?status_indicator()?>**_(Stopped)_**. _(Configuration valid)_.</td><td><input type="button" id="cmdStart" value="_(Start)_" onclick="prepareInput(this.form,this)"></td>
|
||||
|
||||
@@ -22,6 +22,14 @@ function makeList($list) {
|
||||
function sharename($share) {
|
||||
return basename($share,'.cfg');
|
||||
}
|
||||
$subpools = array( "special", "logs", "dedup", "cache", "spares");
|
||||
function isSubpool($name) {
|
||||
global $subpools;
|
||||
// pool name ending in any of these => zfs subpool
|
||||
$tildaPosition = strpos($name, '~');
|
||||
$subpool = ($tildaPosition!==false) ? substr($name, $tildaPosition+1) : false;
|
||||
return ($subpool!==false && in_array($subpool, $subpools)) ? $subpool : false;
|
||||
}
|
||||
$bgcolor = strstr('white,azure',$display['theme']) ? '#f2f2f2' : '#1c1c1c';
|
||||
?>
|
||||
<link type="text/css" rel="stylesheet" href="<?autov("/webGui/styles/jquery.ui.css")?>">
|
||||
@@ -31,7 +39,7 @@ table.divider{margin-top:20px}
|
||||
</style>
|
||||
<script>
|
||||
function validate(poolname) {
|
||||
var valid = /^[a-z]([a-z0-9_-]*[a-z_-])*$/;
|
||||
var valid = /^[a-z]([a-z0-9~._-]*[a-z_-])*$/;
|
||||
var reserved = [<?=makeList(explode(',',_var($var,'reservedNames')))?>];
|
||||
var shares = [<?=makeList(array_map('sharename',glob('boot/config/shares/*.cfg',GLOB_NOSORT)))?>];
|
||||
var pools = [<?=makeList($pools)?>];
|
||||
@@ -82,6 +90,59 @@ function addPoolPopup() {
|
||||
$(".ui-widget-content").css({'background':'<?=$bgcolor?>'});
|
||||
$(".ui-button-text").css({'padding':'0px 5px'});
|
||||
}
|
||||
function removeOption(inputString,value) {
|
||||
// Define a regular expression to match <option>...</option> substrings
|
||||
const optionPattern = /<option .*?<\/option>/g;
|
||||
// Replace all matching substrings that contain "value" with an empty string
|
||||
const result = inputString.replace(optionPattern, (match) => {
|
||||
if (match.includes(value)) {
|
||||
return ''; // Remove the entire substring
|
||||
} else {
|
||||
return match; // Keep the substring as is
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
function addSubpoolPopup(poolname,currentsubpools) {
|
||||
var popup = $('#dialogAddSubpool');
|
||||
// Load popup with the template info
|
||||
popup.html($("#templatePopupSubpool").html());
|
||||
// Remove the options specifed by currentsubpools
|
||||
if (currentsubpools.trim().length !== 0) {
|
||||
var subpools = currentsubpools.split(',');
|
||||
subpools.forEach(function(subpool) {
|
||||
popup.html(function(index, oldHtml) {
|
||||
return removeOption(oldHtml, subpool);
|
||||
});
|
||||
});
|
||||
}
|
||||
// Start Dialog section
|
||||
popup.dialog({
|
||||
title: "_(Add ZFS Subpool)_",
|
||||
resizable: false,
|
||||
width: 600,
|
||||
modal: true,
|
||||
show : {effect:'fade', duration:250},
|
||||
hide : {effect:'fade', duration:250},
|
||||
buttons: {
|
||||
"_(Add)_": function() {
|
||||
subpool=$(this).find('select[name="subpool"]').val();
|
||||
$(this).find('input[name="poolName"]').val(poolname + "~" + subpool);
|
||||
$(this).find('form').submit();
|
||||
$(this).dialog('close');
|
||||
},
|
||||
"_(Cancel)_": function() {
|
||||
$(this).dialog('close');
|
||||
}
|
||||
}
|
||||
});
|
||||
$(".ui-dialog .ui-dialog-titlebar").addClass('menu');
|
||||
$('.ui-dialog .ui-dialog-titlebar-close').css({'display':'none'});
|
||||
$(".ui-dialog .ui-dialog-title").css({'text-align':'center','width':'100%'});
|
||||
$(".ui-dialog .ui-dialog-content").css({'padding-top':'15px','vertical-align':'bottom'});
|
||||
$(".ui-widget-content").css({'background':'<?=$bgcolor?>'});
|
||||
$(".ui-button-text").css({'padding':'0px 5px'});
|
||||
}
|
||||
|
||||
<?if (_var($var,'fsState')=="Started"):?>
|
||||
$('#tab2').bind({click:function() {$('i.toggle').show('slow');}});
|
||||
@@ -92,7 +153,11 @@ $('#tab2').bind({click:function() {$('i.toggle').show('slow');}});
|
||||
<?foreach ($pools as $pool):?>
|
||||
<?if (isset($disks[$pool]['devices']) or _var($var,'fsState')=="Stopped"):?>
|
||||
<table class="disk_status wide<?=$i?' divider':''?>">
|
||||
<?if (isSubpool($pool)):?>
|
||||
<thead></thead>
|
||||
<?else:?>
|
||||
<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></tr></thead>
|
||||
<?endif;?>
|
||||
<tbody id="pool_device<?=$i++?>">
|
||||
<?foreach (cache_filter($disks) as $disk) if (prefix($disk['name'])==$pool) echo "<tr><td colspan='11'> </td></tr>"?>
|
||||
</tbody>
|
||||
@@ -109,6 +174,30 @@ $('#tab2').bind({click:function() {$('i.toggle').show('slow');}});
|
||||
_(Name)_:
|
||||
: <input type="text" name="poolName" maxlength="40" value="<?=count($pools)==0?'cache':''?>">
|
||||
|
||||
_(Slots)_:
|
||||
: <select name="poolSlots">
|
||||
<?for ($n=1; $n<=_var($var,'MAX_CACHESZ',0); $n++):?>
|
||||
<?=mk_option(1,$n,$n)?>
|
||||
<?endfor;?>
|
||||
</select>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id="dialogAddSubpool" style="display:none"></div>
|
||||
<div id="templatePopupSubpool" style="display:none">
|
||||
<form markdown="1" method="POST" action="/update.htm" target="progressFrame">
|
||||
<input type="hidden" name="changeSlots" value="apply">
|
||||
<input type="hidden" name="poolName" value="">
|
||||
_(Name)_:
|
||||
: <select name="subpool">
|
||||
<?=mk_option("","special","special - Special Allocation Class")?>
|
||||
<?=mk_option("","logs","logs - ZFS Intent Log")?>
|
||||
<?=mk_option("","dedup","dedup - Deduplication Tables")?>
|
||||
<?=mk_option("","cache","cache - Cache Devices")?>
|
||||
<?=mk_option("","spares","spares - Hot Spares")?>
|
||||
</select>
|
||||
|
||||
_(Slots)_:
|
||||
: <select name="poolSlots">
|
||||
<?for ($n=1; $n<=_var($var,'MAX_CACHESZ',0); $n++):?>
|
||||
|
||||
Regular → Executable
+66
-32
@@ -80,6 +80,13 @@ function maintenance_mode() {
|
||||
global $var;
|
||||
return _var($var,'fsState')=="Started" && _var($var,'startMode')=="Maintenance" && _var($disk,'luksState',0)<=1;
|
||||
}
|
||||
function isSubpool($name) {
|
||||
// pool name ending in any of these => zfs subpool
|
||||
$subpools = array( "special", "logs", "dedup", "cache", "spares");
|
||||
$tildaPosition = strpos($name, '~');
|
||||
$subpool = ($tildaPosition!==false) ? substr($name, $tildaPosition+1) : false;
|
||||
return ($subpool!==false && in_array($subpool, $subpools)) ? $subpool : false;
|
||||
}
|
||||
function isPool($name) {
|
||||
global $pools;
|
||||
return in_array($name,$pools);
|
||||
@@ -220,8 +227,8 @@ function selectDiskFsWidth(num_devices,selected_width) {
|
||||
} else {
|
||||
var width, min_width;
|
||||
if ($('#diskFsProfileZFS').val() == 'raidz1') min_width = 3;
|
||||
else if ($('#diskFsProfileZFS').val() == 'raidz2') min_width = 4;
|
||||
else if ($('#diskFsProfileZFS').val() == 'raidz3') min_width = 5;
|
||||
else if ($('#diskFsProfileZFS').val() == 'raidz2') min_width = 3;
|
||||
else if ($('#diskFsProfileZFS').val() == 'raidz3') min_width = 4;
|
||||
for (width=min_width; width<=num_devices; width++) {
|
||||
if ((num_devices % width) == 0) {
|
||||
var groups = num_devices / width;
|
||||
@@ -235,7 +242,7 @@ function selectDiskFsWidth(num_devices,selected_width) {
|
||||
}
|
||||
}
|
||||
}
|
||||
function selectDiskFsProfile(num_devices, width, init) {
|
||||
function selectDiskFsProfile(num_slots, width, init) {
|
||||
var t = init ? null : 'slow';
|
||||
if (($('#diskFsType').val()||'').indexOf('auto') != -1) {
|
||||
$('#diskFsProfileBTRFS').prop('disabled',true).hide();
|
||||
@@ -260,7 +267,7 @@ function selectDiskFsProfile(num_devices, width, init) {
|
||||
}
|
||||
$('#diskFsProfileZFS').show();
|
||||
$('#diskFsWidthZFS').show();
|
||||
selectDiskFsWidth(num_devices, width);
|
||||
selectDiskFsWidth(num_slots, width);
|
||||
$('#compression').show(t);
|
||||
<?if (diskType('Cache')):?>
|
||||
$('#autotrim').show(t);
|
||||
@@ -452,7 +459,7 @@ function updateMode(form,mode) {
|
||||
$(form).find('input[name="#arg[3]"]').val(mode);
|
||||
}
|
||||
function validate(poolname) {
|
||||
var valid = /^[a-z_]([a-z0-9_-]*[a-z_])*$/;
|
||||
var valid = /^[a-z_]([a-z0-9~._-]*[a-z_])*$/;
|
||||
var reserved = [<?=makeList(explode(',',_var($var,'reservedNames')))?>];
|
||||
var shares = [<?=makeList(array_map('sharename',glob('boot/config/shares/*.cfg',GLOB_NOSORT)))?>];
|
||||
var pools = [<?=makeList($pools)?>];
|
||||
@@ -537,7 +544,7 @@ function eraseDisk(name) {
|
||||
</script>
|
||||
|
||||
<form markdown="1" method="POST" action="/update.htm" target="progressFrame" onsubmit="setFloor()">
|
||||
<?if (_var($var,'fsState')=="Stopped" && isPool($name)):?>
|
||||
<?if (_var($var,'fsState')=="Stopped" && isPool($name) && !isSubpool($name)):?>
|
||||
_(Name)_:
|
||||
: <a onclick="renamePoolPopup()" style="cursor:pointer" title="_(Rename Pool)_"><?=$name?></a>
|
||||
|
||||
@@ -556,7 +563,7 @@ _(Identification)_:
|
||||
|
||||
<?endif;?>
|
||||
<?if (!$unassigned):?>
|
||||
<?if (diskType('Data') || (diskType('Cache') && isPool(_var($disk,'name')))):?>
|
||||
<?if (diskType('Data') || (diskType('Cache') && isPool($name) && !isSubpool($name))):?>
|
||||
_(Comments)_:
|
||||
: <input type="text" name="diskComment.<?=_var($disk,'idx',0)?>" maxlength="256" value="<?=htmlspecialchars(_var($disk,'comment'))?>">
|
||||
|
||||
@@ -569,11 +576,13 @@ _(Partition size)_:
|
||||
_(Partition format)_:
|
||||
: <?=_(_var($disk,'format'))?>
|
||||
|
||||
<?endif;?>
|
||||
<?if (_var($var,'spinupGroups')=="yes" && diskType('Data','Parity')):?>
|
||||
_(Spinup group(s))_:
|
||||
: <input type="text" name="diskSpinupGroup.<?=_var($disk,'idx',0)?>" maxlength="256" value="<?=_var($disk,'spinupGroup')?>">
|
||||
|
||||
<?endif;?>
|
||||
<?if (diskType('Data') || isPool($tag)):?>
|
||||
_(Spin down delay)_:
|
||||
: <select name="diskSpindownDelay.<?=_var($disk,'idx',0)?>">
|
||||
<?=mk_option(_var($disk,'spindownDelay'), "-1", _('Use default'))?>
|
||||
@@ -591,14 +600,12 @@ _(Spin down delay)_:
|
||||
<?=mk_option(_var($disk,'spindownDelay'), "8", "8 "._('hours'))?>
|
||||
<?=mk_option(_var($disk,'spindownDelay'), "9", "9 "._('hours'))?>
|
||||
</select><span id="smart_selftest" class='orange-text'></span>
|
||||
<?endif;?>
|
||||
|
||||
<?if (diskType('Data') || isPool($tag)):?>
|
||||
_(File system status)_:
|
||||
: <?=_(_var($disk,'fsStatus'))?>
|
||||
|
||||
<?$disabled = ((_var($var,'fsState')=="Stopped" && _var($var,'mdState')=="SWAP_DSBL") || _var($var,'fsState')=="Started" || _var($disk,'fsStatus')=='Mounted') || _var($disk,'uuid') ? "disabled" : ""?>
|
||||
<?if (diskType('Data') || _var($disk,'slots',0)==1):?>
|
||||
<?$disabled = (_var($var,'fsState')=="Stopped" && _var($disk,'uuid')) || (_var($var,'fsState')=="Started" && _var($disk,'fsStatus')=='Mounted') ? "disabled" : ""?>
|
||||
<?if (diskType('Data') || (!isSubpool($name) && _var($disk,'slots',0)==1)):?>
|
||||
_(File system type)_:
|
||||
: <select id="diskFsType" name="diskFsType.<?=_var($disk,'idx',0)?>" onchange="changeFsType()" <?=$disabled?>>
|
||||
<?=mk_option(_var($disk,'fsType'), "auto", _('auto'))?>
|
||||
@@ -614,9 +621,9 @@ _(File system type)_:
|
||||
|
||||
:info_file_system_help:
|
||||
|
||||
<?elseif (_var($disk,'slots',0)>1):?>
|
||||
<?elseif (!isSubpool($name) && _var($disk,'slots',0)>1):?>
|
||||
_(File system type)_:
|
||||
: <select id="diskFsType" name="diskFsType.<?=_var($disk,'idx',0)?>" onchange="selectDiskFsProfile(<?=_var($disk,'devices',0)?>,0)" <?=$disabled?>>
|
||||
: <select id="diskFsType" name="diskFsType.<?=_var($disk,'idx',0)?>" onchange="selectDiskFsProfile(<?=_var($disk,'slots',0)?>,0)" <?=$disabled?>>
|
||||
<?=mk_option(_var($disk,'fsType'), "auto", _('auto'))?>
|
||||
<?=mk_option(_var($disk,'fsType'), "zfs", _('zfs'))?>
|
||||
<?=mk_option(_var($disk,'fsType'), "btrfs", _('btrfs'))?>
|
||||
@@ -625,26 +632,55 @@ _(File system type)_:
|
||||
</select>
|
||||
<select id="diskFsProfileBTRFS" name="diskFsProfile.<?=_var($disk,'idx',0)?>" style="display:none" <?=$disabled?>>
|
||||
<?=mk_option(_var($disk,'fsProfile'),"single", _('single'))?>
|
||||
<?if (_var($disk,'devices',0)>=2) echo mk_option(_var($disk,'fsProfile'),"raid0", _('raid0'))?>
|
||||
<?if (_var($disk,'devices',0)>=2) echo mk_option(_var($disk,'fsProfile'),"raid1", _('raid1'))?>
|
||||
<?if (_var($disk,'devices',0)>=3) echo mk_option(_var($disk,'fsProfile'),"raid1c3", _('raid1c3'))?>
|
||||
<?if (_var($disk,'devices',0)>=4) echo mk_option(_var($disk,'fsProfile'),"raid1c4", _('raid1c4'))?>
|
||||
<?if (_var($disk,'devices',0)>=4) echo mk_option(_var($disk,'fsProfile'),"raid10", _('raid10'))?>
|
||||
<?if (_var($disk,'devices',0)>=3) echo mk_option(_var($disk,'fsProfile'),"raid5", _('raid5'))?>
|
||||
<?if (_var($disk,'devices',0)>=4) echo mk_option(_var($disk,'fsProfile'),"raid6", _('raid6'))?>
|
||||
<?if (_var($disk,'slots',0)>=2) echo mk_option(_var($disk,'fsProfile'),"raid0", _('raid0'))?>
|
||||
<?if (_var($disk,'slots',0)>=2) echo mk_option(_var($disk,'fsProfile'),"raid1", _('raid1'))?>
|
||||
<?if (_var($disk,'slots',0)>=3) echo mk_option(_var($disk,'fsProfile'),"raid1c3", _('raid1c3'))?>
|
||||
<?if (_var($disk,'slots',0)>=4) echo mk_option(_var($disk,'fsProfile'),"raid1c4", _('raid1c4'))?>
|
||||
<?if (_var($disk,'slots',0)>=4) echo mk_option(_var($disk,'fsProfile'),"raid10", _('raid10'))?>
|
||||
<?if (_var($disk,'slots',0)>=3) echo mk_option(_var($disk,'fsProfile'),"raid5", _('raid5'))?>
|
||||
<?if (_var($disk,'slots',0)>=4) echo mk_option(_var($disk,'fsProfile'),"raid6", _('raid6'))?>
|
||||
</select>
|
||||
<select id="diskFsProfileZFS" name="diskFsProfile.<?=_var($disk,'idx',0)?>" style="display:none" onchange="selectDiskFsWidth(<?=_var($disk,'devices',0)?>,0)" <?=$disabled?>>
|
||||
<?if (_var($disk,'devices',0)==1) echo mk_option(_var($disk,'fsProfile'),"", _('single'))?>
|
||||
<?if (_var($disk,'devices',0)>=2) echo mk_option(_var($disk,'fsProfile'),"", _('raid0'))?>
|
||||
<?if ((_var($disk,'devices',0)%2)==0 || (_var($disk,'devices',0)%3)==0 || (_var($disk,'devices',0)%4)==0) echo mk_option(_var($disk,'fsProfile'),"mirror", _('mirror'))?>
|
||||
<?if (_var($disk,'devices',0)>=3) echo mk_option(_var($disk,'fsProfile'),"raidz1", _('raidz'))?>
|
||||
<?if (_var($disk,'devices',0)>=4) echo mk_option(_var($disk,'fsProfile'),"raidz2", _('raidz2'))?>
|
||||
<?if (_var($disk,'devices',0)>=5) echo mk_option(_var($disk,'fsProfile'),"raidz3", _('raidz3'))?>
|
||||
<select id="diskFsProfileZFS" name="diskFsProfile.<?=_var($disk,'idx',0)?>" style="display:none" onchange="selectDiskFsWidth(<?=_var($disk,'slots',0)?>,0)" <?=$disabled?>>
|
||||
<?if (_var($disk,'slots',0)==1) echo mk_option(_var($disk,'fsProfile'),"", _('single'))?>
|
||||
<?if (_var($disk,'slots',0)>=2) echo mk_option(_var($disk,'fsProfile'),"", _('raid0'))?>
|
||||
<?if ((_var($disk,'slots',0)%2)==0 || (_var($disk,'slots',0)%3)==0 || (_var($disk,'slots',0)%4)==0) echo mk_option(_var($disk,'fsProfile'),"mirror", _('mirror'))?>
|
||||
<?if (_var($disk,'slots',0)>=3) echo mk_option(_var($disk,'fsProfile'),"raidz1", _('raidz'))?>
|
||||
<?if (_var($disk,'slots',0)>=3) echo mk_option(_var($disk,'fsProfile'),"raidz2", _('raidz2'))?>
|
||||
<?if (_var($disk,'slots',0)>=4) echo mk_option(_var($disk,'fsProfile'),"raidz3", _('raidz3'))?>
|
||||
</select>
|
||||
<select id="diskFsWidthZFS" name="diskFsWidth.<?=_var($disk,'idx',0)?>" style="display:none" <?=$disabled?>>
|
||||
</select>
|
||||
<?elseif (isSubpool($name)=="special" || isSubpool($name)=="logs" || isSubpool($name)=="dedup"):?>
|
||||
_(File system type)_:
|
||||
: <select id="diskFsType" name="diskFsType.<?=_var($disk,'idx',0)?>" onchange="selectDiskFsProfile(<?=_var($disk,'slots',0)?>,0)" <?=$disabled?>>
|
||||
<?=mk_option(_var($disk,'fsType'), "zfs", _('zfs'))?>
|
||||
</select>
|
||||
<select id="diskFsProfileZFS" name="diskFsProfile.<?=_var($disk,'idx',0)?>" onchange="selectDiskFsWidth(<?=_var($disk,'slots',0)?>,0)" <?=$disabled?>>
|
||||
<?if (_var($disk,'slots',0)==1) echo mk_option(_var($disk,'fsProfile'),"", _('single'))?>
|
||||
<?if (_var($disk,'slots',0)>=2) echo mk_option(_var($disk,'fsProfile'),"", _('raid0'))?>
|
||||
<?if ((_var($disk,'slots',0)%2)==0 || (_var($disk,'slots',0)%3)==0 || (_var($disk,'slots',0)%4)==0) echo mk_option(_var($disk,'fsProfile'),"mirror", _('mirror'))?>
|
||||
</select>
|
||||
<select id="diskFsWidthZFS" name="diskFsWidth.<?=_var($disk,'idx',0)?>" style="display:none" <?=$disabled?>>
|
||||
</select>
|
||||
<?elseif (isSubpool($name)=="cache"):?>
|
||||
_(File system type)_:
|
||||
: <select id="diskFsType" name="diskFsType.<?=_var($disk,'idx',0)?>" onchange="selectDiskFsProfile(<?=_var($disk,'slots',0)?>,0)" <?=$disabled?>>
|
||||
<?=mk_option(_var($disk,'fsType'), "zfs", _('zfs'))?>
|
||||
</select>
|
||||
<select id="diskFsProfileZFS" name="diskFsProfile.<?=_var($disk,'idx',0)?>" onchange="selectDiskFsWidth(<?=_var($disk,'slots',0)?>,0)" <?=$disabled?>>
|
||||
<?if (_var($disk,'slots',0)==1) echo mk_option(_var($disk,'fsProfile'),"", _('single'))?>
|
||||
<?if (_var($disk,'slots',0)>=2) echo mk_option(_var($disk,'fsProfile'),"", _('raid0'))?>
|
||||
</select>
|
||||
<select id="diskFsWidthZFS" name="diskFsWidth.<?=_var($disk,'idx',0)?>" style="display:none" <?=$disabled?>>
|
||||
</select>
|
||||
<?elseif (isSubpool($name)=="spares"):?>
|
||||
_(File system type)_:
|
||||
: <select id="diskFsType" name="diskFsType.<?=_var($disk,'idx',0)?>" onchange="selectDiskFsProfile(<?=_var($disk,'slots',0)?>,0)" <?=$disabled?>>
|
||||
<?=mk_option(_var($disk,'fsType'), "zfs", _('zfs'))?>
|
||||
</select>
|
||||
<?endif;?>
|
||||
|
||||
<?if (isSubpool($name)===false):?>
|
||||
<div markdown="1" id="compression" style="display:none">
|
||||
_(Compression)_:
|
||||
<?$disabled = _var($disk,'fsStatus')=='Mounted' ? "disabled" : ""?>
|
||||
@@ -693,6 +729,7 @@ _(Critical disk utilization threshold)_ (%):
|
||||
|
||||
:info_critical_utilization_help:
|
||||
|
||||
<?endif;?>
|
||||
<?endif;?>
|
||||
|
||||
: <input type="submit" name="changeDisk" value="_(Apply)_" disabled><input type="button" id="doneButton" value="_(Done)_" onclick="done()">
|
||||
@@ -973,7 +1010,7 @@ _(btrfs check status)_:
|
||||
<?endif;?>
|
||||
</form>
|
||||
<?endif;?>
|
||||
<?if (fsType('zfs')):?>
|
||||
<?if (fsType('zfs') && !isSubpool($name)):?>
|
||||
<div class="title nocontrol"><span class="left"><i class="title fa fa-info"></i>_(Pool Status)_</span></div>
|
||||
<form markdown="1" method="POST" action="/update.php" target="progressFrame" onsubmit="prepareFS(this,'zfs-scrub-<?=$tag?>','<?=$tag?>')">
|
||||
<?if (_var($disk,'fsStatus')=="Mounted"):?>
|
||||
@@ -1303,10 +1340,7 @@ $(function() {
|
||||
}
|
||||
});
|
||||
}
|
||||
var groups = <?=_var($disk,'fsGroups',0)?:0?>;
|
||||
var width = <?=_var($disk,'fsWidth',0)?:0?>;
|
||||
var devices = (groups==0 || width==0) ? <?=_var($disk,'devices',0)?:0?> : groups * width;
|
||||
selectDiskFsProfile(devices,width,true);
|
||||
selectDiskFsProfile(<?=_var($disk,'slots',0)?>,true);
|
||||
<?if (fsType('btrfs')):?>
|
||||
presetBTRFS(document.balance_schedule,'#balance-hour');
|
||||
presetBTRFS(document.scrub_schedule,'#scrub-hour');
|
||||
|
||||
@@ -36,9 +36,17 @@ function initSum() {
|
||||
function model($id) {
|
||||
return substr($id,0,strrpos($id,'_'));
|
||||
}
|
||||
$subpools = array( "special", "logs", "dedup", "cache", "spares");
|
||||
function isSubpool($name) {
|
||||
// pool name ending in any of these => zfs subpool
|
||||
global $subpools;
|
||||
$tildaPosition = strpos($name, '~');
|
||||
$subpool = ($tildaPosition!==false) ? substr($name, $tildaPosition+1) : false;
|
||||
return ($subpool!==false && in_array($subpool, $subpools)) ? $subpool : false;
|
||||
}
|
||||
function device_info(&$disk,$online) {
|
||||
global $pools, $var, $crypto;
|
||||
if (!$online || _var($disk,'fsStatus')!='Mounted' || (in_array(_var($disk,'type'),['Parity','Cache']) && !in_array(_var($disk,'name'),$pools))) {
|
||||
if (!$online || _var($disk,'fsStatus')!='Mounted' || (in_array(_var($disk,'type'),['Parity','Cache']) && (!in_array(_var($disk,'name'),$pools) || isSubpool(_var($disk,'name'))))) {
|
||||
$view = "<a class='view'></a>";
|
||||
} else {
|
||||
$dir = _var($disk,'name')=='flash' ? "/boot" : "/mnt/"._var($disk,'name');
|
||||
@@ -115,10 +123,10 @@ function device_desc(&$disk) {
|
||||
function assignment(&$disk) {
|
||||
global $var, $devs;
|
||||
$echo = [];
|
||||
$echo[] = "<form method='POST' id=\""._var($disk,'name')."Form\" action='/update.htm' target='progressFrame'>";
|
||||
$echo[] = "<form method='POST' action='/update.htm' target='progressFrame'>";
|
||||
$echo[] = "<input type='hidden' name='changeDevice' value='apply'>";
|
||||
$echo[] = "<input type='hidden' name='csrf_token' value='"._var($var,'csrf_token')."'>";
|
||||
$echo[] = "<select class='slot' name='slotId."._var($disk,'idx')."' onChange='\$(\"#"._var($disk,'name')."Form\").submit()'>";
|
||||
$echo[] = "<select class='slot' name='slotId."._var($disk,'idx')."' onChange='this.form.submit()'>";
|
||||
$empty = _var($disk,'idSb')!='' ? _('no device') : _('unassigned');
|
||||
if (_var($disk,'id')) {
|
||||
$echo[] = "<option value=\"{$disk['id']}\" selected>".device_desc($disk)."</option>";
|
||||
@@ -450,7 +458,20 @@ while (true) {
|
||||
}
|
||||
$data = []; foreach ($log as $key => $value) $data[] = "$key=\"$value\"";
|
||||
file_put_contents($pool_log,implode("\n",$data));
|
||||
$echo[$n] .= "<tr class='tr_last'><td>"._('Slots').":</td><td colspan='8'>".cache_slots($off,$pool,_var($cache[$pool],'devicesSb'),_var($cache[$pool],'slots',0))."</td><td></td></tr>";
|
||||
$echo[$n] .= "<tr class='tr_last'><td>"._('Slots')."</td><td colspan='8'>".cache_slots($off,$pool,_var($cache[$pool],'devicesSb'),_var($cache[$pool],'slots',0))."</td><td></td></tr>";
|
||||
$zfsPool = strstr(_var($cache[$pool],'fsType'),'zfs') && !isSubpool($pool);
|
||||
if ($zfsPool) {
|
||||
$current_subpools = array_filter($pools, function ($element) {
|
||||
return strpos($element, "$pool~")!==false;
|
||||
});
|
||||
if (count($current_subpools) < count($subpools)) {
|
||||
$current_subpools_list = str_replace("$pool~","", implode(',', $current_subpools));
|
||||
$subPoolButton = "<input type='button' value='Add Subpool' style='margin:0' onclick='addSubpoolPopup(\"$pool\",\"$current_subpools_list\")'>";
|
||||
} else {
|
||||
$subPoolButton = "<input type='button' value='Add Subpool' style='margin:0' disabled>";
|
||||
}
|
||||
$echo[$n] .= "<tr class='tr_last'><td></td><td colspan='8'>$subPoolButton</td><td></td></tr>";
|
||||
}
|
||||
} else {
|
||||
foreach ($cache as $disk) if (prefix($disk['name'])==$pool) {
|
||||
if (isset($disk['fsType'])) $fstype = vfs_type($disk['fsType']);
|
||||
|
||||
Reference in New Issue
Block a user