Retention Editor added in UI
Time set in Schedular added
This commit is contained in:
1 parent
c272b00c81
commit
4af9f32c46
6 files changed
+86
-9
No files matched your search
@@ -80,7 +80,7 @@ export async function runBackupJob(job) {
|
||||
|
||||
setJobStep(job, 'Applying Restic retention policy');
|
||||
setJobProgress(job, { percent: 96 });
|
||||
await runRestic(['forget', '--tag', job.vmName, '--keep-daily', '7', '--prune'], {
|
||||
await runRestic(retentionArgs(job.vmName), {
|
||||
log: (line) => appendJobLog(job, line),
|
||||
});
|
||||
|
||||
@@ -115,6 +115,25 @@ function formatBytes(value) {
|
||||
return `${size.toFixed(unitIndex === 0 ? 0 : 1)} ${units[unitIndex]}`;
|
||||
}
|
||||
|
||||
function retentionArgs(vmName) {
|
||||
const args = ['forget', '--tag', vmName, '--prune'];
|
||||
const keepDaily = positiveInteger(config.retention.keepDaily);
|
||||
const keepWeekly = positiveInteger(config.retention.keepWeekly);
|
||||
const keepMonthly = positiveInteger(config.retention.keepMonthly);
|
||||
|
||||
if (keepDaily) args.push('--keep-daily', String(keepDaily));
|
||||
if (keepWeekly) args.push('--keep-weekly', String(keepWeekly));
|
||||
if (keepMonthly) args.push('--keep-monthly', String(keepMonthly));
|
||||
if (!keepDaily && !keepWeekly && !keepMonthly) args.push('--keep-daily', '7');
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
function positiveInteger(value) {
|
||||
const number = Number(value);
|
||||
return Number.isFinite(number) && number > 0 ? Math.floor(number) : 0;
|
||||
}
|
||||
|
||||
async function cleanupBackup(job, zvol, snapshotName) {
|
||||
setJobStep(job, 'Running cleanup');
|
||||
await spawnCommand('zfs', ['set', 'snapdev=hidden', zvol], {
|
||||
|
||||
Reference in new issue
Block a user