0.12.0: FIFO job retention (job_keep), clear-finished button, vmm-ctl prune
This commit is contained in:
1 parent
5dc6bfb5a2
commit
a1b4e884da
9 files changed
+83
-3
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"appname": "VM Manager",
|
||||
"version": "0.11.0",
|
||||
"version": "0.12.0",
|
||||
"rootfolder": "/mnt/Daten/extensions/vmmngr",
|
||||
"vm_source": "auto",
|
||||
"bridges": ["ix0bridge"],
|
||||
@@ -8,5 +8,6 @@
|
||||
"enable": true,
|
||||
"job_timeout": 900,
|
||||
"after_action": "stay",
|
||||
"job_keep": 100,
|
||||
"ram_budget_pct": 85
|
||||
}
|
||||
@@ -10,6 +10,8 @@ if (strtoupper((string)($_SERVER['REQUEST_METHOD'] ?? '')) === 'POST' && ($_POST
|
||||
$conf = vmm_config();
|
||||
$conf['after_action'] = ($_POST['after_action'] ?? 'stay') === 'log' ? 'log' : 'stay';
|
||||
$conf['vm_source'] = in_array($_POST['vm_source'] ?? '', ['auto', 'system', 'bundle'], true) ? $_POST['vm_source'] : 'auto';
|
||||
$keep = (int)($_POST['job_keep'] ?? 100);
|
||||
$conf['job_keep'] = ($keep >= 0 && $keep <= 10000) ? $keep : 100;
|
||||
vmm_save_config($conf);
|
||||
$_SESSION['vmmngr_error'] = gettext('Settings saved.');
|
||||
header('Location: vmmngr_config.php');
|
||||
@@ -55,6 +57,13 @@ vmm_nav('config'); ?>
|
||||
<button type="submit" class="formbtn" name="act" value="save_settings" style="margin-left:8px;"><?=gettext('Save');?></button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="celltag"><?=gettext('Job retention');?></td>
|
||||
<td class="celldata">
|
||||
<input type="text" name="job_keep" size="6" value="<?=(int)($conf['job_keep'] ?? 100);?>"/>
|
||||
<span style="opacity:.75;margin-left:8px;"><?=gettext('finished jobs to keep (FIFO); 0 = delete after each run');?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="celltag">vm_source</td>
|
||||
<td class="celldata">
|
||||
|
||||
@@ -5,6 +5,13 @@
|
||||
|
||||
require_once 'vmmngr-boot.inc';
|
||||
|
||||
if (strtoupper((string)($_SERVER['REQUEST_METHOD'] ?? '')) === 'POST' && ($_POST['act'] ?? '') === 'clear_jobs') {
|
||||
$res = vmm_job_prune(0);
|
||||
$_SESSION['vmmngr_error'] = sprintf(gettext('Removed %d finished job(s).'), (int)$res['removed']);
|
||||
header('Location: vmmngr_jobs.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$pgtitle = [gettext('Extensions'), gettext('VM Manager'), gettext('Jobs')];
|
||||
$id = (string)($_GET['id'] ?? '');
|
||||
$job = $id !== '' ? vmm_job_get($id) : null;
|
||||
@@ -21,6 +28,10 @@ vmm_nav('jobs');
|
||||
|
||||
<form action="vmmngr_jobs.php" method="post" name="iform" id="iform"><table id="area_data"><tbody><tr><td id="area_data_frame">
|
||||
|
||||
<?php if (!empty($_SESSION['vmmngr_error'])): ?>
|
||||
<?php print_info_box(vmm_h((string)$_SESSION['vmmngr_error'])); unset($_SESSION['vmmngr_error']); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($job !== null): ?>
|
||||
<table class="area_data_settings" style="width:100%;border-collapse:collapse;">
|
||||
<colgroup>
|
||||
@@ -52,6 +63,12 @@ vmm_nav('jobs');
|
||||
<br />
|
||||
<?php endif; ?>
|
||||
|
||||
<p>
|
||||
<button type="submit" class="formbtn" name="act" value="clear_jobs"
|
||||
onclick="return confirm('Remove all finished jobs? Running jobs are kept.')"><?=gettext('Clear finished jobs');?></button>
|
||||
<span style="opacity:.75;margin-left:8px;"><?=gettext('Retention keeps the newest %d jobs automatically (Configuration).', (int)(vmm_config()['job_keep'] ?? 100));?></span>
|
||||
</p>
|
||||
|
||||
<table class="area_data_selection" style="width:100%;border-collapse:collapse;">
|
||||
<colgroup>
|
||||
<col style="width:26%">
|
||||
|
||||
Reference in new issue
Block a user