Shares: changed "cache" options

This is a prroposal
This commit is contained in:
bergware
2023-04-03 22:05:30 +02:00
parent 06e3c0c887
commit 4f13764740
4 changed files with 51 additions and 12 deletions
+26
View File
@@ -578,6 +578,32 @@ disks are not selected here, then the share may expand into *all* array disks.
Specify the disks which can *not* be used by the share. By default no disks are excluded.
:end
:share_edit_cache_pool_help_20230401:
Specify whether new files and folders written on the share can be written onto the pool if present.
This setting also affects *mover* behavior.
**On array only** prohibits new files and folders from being written onto the pool.
*Mover* will take no action so any existing files for this share that are on the pool are left there.
**On pool, overflow or move to array** indicates that all new files and folders should be written to the pool, provided
enough free space exists on the pool.
If there is insufficient space on the pool, then new files and folders are created on the array.
When the *mover* is invoked, files and folders are transferred off the pool and onto the array.
**On pool only** indicates that all new files and folders must be written to the pool.
If there is insufficient free space on the pool, *create* operations will fail with *out of space* status.
*Mover* will take no action so any existing files for this share that are on the array are left there.
**On pool if present else on array, move to pool** indicates that all new files and folders should be written to the pool, provided
enough free space exists on the pool.
If there is insufficient space on the pool, then new files and folders are created on the array.
When the *mover* is invoked, files and folders are transferred off the array and onto the pool.
**NOTE:** Mover will never move any files that are currently in use.
This means if you want to move files associated with system services such as Docker or VMs then you need to
disable these services while mover is running.
:end
:share_edit_cache_pool_help:
Specify whether new files and directories written on the share can be written onto the Cache disk/pool if present.
This setting also affects *mover* behavior.
+10 -10
View File
@@ -100,17 +100,17 @@ _(Comments)_:
:share_edit_comments_help:
_(Use cache pool (for new files/directories))_:
: <span class="input"><select name="shareUseCache" onchange="updateScreen(this.value)"<?=$pool_devices?'':' disabled'?>>
<?=mk_option($share['useCache'], "no", _('No'))?>
<?=mk_option($share['useCache'], "yes", _('Yes'))?>
<?=mk_option($share['useCache'], "prefer", _('Prefer'))?>
<?=mk_option($share['useCache'], "only", _('Only'))?>
_(Placement of new files/folders)_:
: <span class="input"><select name="shareUseCache" style="width:<?=$themes1?'300':'314'?>px" onchange="updateScreen(this.value)"<?=$pool_devices?'':' disabled'?>>
<?=mk_option($share['useCache'], "no", _('On array only'))?>
<?=mk_option($share['useCache'], "yes", _('On pool, overflow or move to array'))?>
<?=mk_option($share['useCache'], "prefer", _('On pool if present else on array, move to pool'))?>
<?=mk_option($share['useCache'], "only", _('On pool only'))?>
</select></span><span id="moverAction"></span>
:share_edit_cache_pool_help:
_(Select cache pool)_:
_(Select pool)_:
: <select name="shareCachePool">
<?foreach ($pools as $pool):?>
<?if ($disks[$pool]['devices']) echo mk_option($share['cachePool'],$pool,ucfirst($pool),$disks[$pool]['shareEnabled']=='yes'?"":"disabled")?>
@@ -140,7 +140,7 @@ _(Minimum free space)_:
:share_edit_free_space_help:
_(Split level)_:
: <select name="shareSplitLevel">
: <select name="shareSplitLevel" style="max-width:<?=$themes1?'300':'321'?>px">
<?=mk_option($share['splitLevel'], "", _('Automatically split any directory as required'))?>
<?=mk_option($share['splitLevel'], "1", _('Automatically split only the top level directory as required'))?>
<?=mk_option($share['splitLevel'], "2", _('Automatically split only the top two directory levels as required'))?>
@@ -219,10 +219,10 @@ function initDropdown(remove,create) {
function updateScreen(cache) {
switch (cache) {
case 'yes':
var textAction = "_(Mover transfers files from cache to array)_";
var textAction = "_(Mover transfers files from pool to array)_";
break;
case 'prefer':
var textAction = "_(Mover transfers files from array to cache)_";
var textAction = "_(Mover transfers files from array to pool)_";
break;
default:
var textAction = "_(Mover takes no action)_";
+1 -1
View File
@@ -39,7 +39,7 @@ table.share_status thead tr td:nth-child(n+3){width:10%}
</style>
<table class="share_status">
<thead><tr><td>_(Name)_</td><td>_(Comment)_</td><td>_(SMB)_</td><td>_(NFS)_</td><td>_(Cache)_</td><td>_(Size)_</td><td>_(Free)_</td></tr></thead>
<thead><tr><td>_(Name)_</td><td>_(Comment)_</td><td>_(SMB)_</td><td>_(NFS)_</td><td>_(Placement)_</td><td>_(Size)_</td><td>_(Free)_</td></tr></thead>
<tbody id="shareslist"></tbody>
</table>
<p><form name="share_form" method="POST" action="<?=htmlspecialchars($path)?>/Share?name=">
+14 -1
View File
@@ -104,7 +104,20 @@ foreach ($shares as $name => $share) {
$share['useCache'] = "no";
}
}
$cache = _(ucfirst($share['useCache'])).($share['useCache']!='no'?' : '.compress(my_disk($share['cachePool'],$display['raw'])):'');
switch ($share['useCache']) {
case 'no':
$cache = "<a class='hand info none' onclick='return false'><i class='fa fa-database'></i><span>"._('Array')."</span></a>";
break;
case 'yes':
$cache = "<a class='hand info none' onclick='return false'><i class='fa fa-bullseye'></i> ".compress(my_disk($share['cachePool'],$display['raw']))." <i class='fa fa-share-square-o fa-fw'></i><i class='fa fa-long-arrow-right fa-fw'></i><i class='fa fa-database fa-fw'></i><span>"._('Pool, overflow or move to Array')."</span></a>";
break;
case 'prefer':
$cache = "<a class='hand info none' onclick='return false'><i class='fa fa-bullseye'></i> <i class='fa fa-database fa-fw'></i><i class='fa fa-long-arrow-right fa-fw'></i><i class='fa fa-bullseye fa-fw'></i>".compress(my_disk($share['cachePool'],$display['raw']))."<span>"._('Pool else Array, move to Pool')."</span></a>";
break;
case 'only':
$cache = "<a class='hand info none' onclick='return false'><i class='fa fa-bullseye'></i> ".compress(my_disk($share['cachePool'],$display['raw']))."<span>"._('Pool')."</span></a>";
break;
}
if (array_key_exists($name, $ssz1)) {
echo "<td>$cache</td>";
echo "<td>",my_scale($ssz1[$name]['disk.total'], $unit)," $unit</td>";