1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 17:36:05 +00:00

feat(backups): verify a backup's files on demand

The daily target check only finds files that are gone. Verify (a ready
backup's Restore menu, superusers) runs backup.verify: it reads the
backup's files and those of the backups it builds on whole from the
target through a libvirt stream: each there, a disk at its size and in
its format on its base's file, the small files with their SHA-256, and
a disk with the SHA-256 recorded at its first verification. What is
wrong is kept on the backup and shown as Damaged; a target that cannot
be read fails the job and leaves the backup as it was. Progress in
bytes, cancellable.
This commit is contained in:
catborise 2026-11-19 15:25:20 +03:00
parent eeae606d08
commit 2cf7dbe577
14 changed files with 891 additions and 231 deletions

View file

@ -231,6 +231,22 @@ def delete(request, uuid):
return redirect(same_origin_referer(request, reverse("vmbackups:index")))
@require_POST
@superuser_only
def verify(request, uuid):
"""Verify a backup: a backup.verify job, followed on its page."""
backup = get_object_or_404(Backup, uuid=uuid)
try:
op = jobs.submit("backup.verify", request.user, {"backup": str(backup.uuid)}, request.POST.get("submission_key", ""))
except claims.Busy as busy:
messages.error(request, busy_message(busy, request.user))
except (jobs.SubmissionConflict, libvirtError) as err:
messages.error(request, error_text(request, err))
else:
return redirect("operations:job", op.pk)
return redirect(same_origin_referer(request, reverse("vmbackups:index")))
@login_required
def restore(request, uuid):
"""Restore a ready backup as a new VM: a backup.restore job, followed on