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

@ -122,6 +122,10 @@ class Backup(models.Model):
# whose job made it: a VM owner's own backups count in their backup quota
taken_by = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, null=True, related_name="+")
prefix = models.CharField(max_length=128) # every file of the backup in the target begins with it and "-"
# its last verification (backup.verify) that read the files: when, and what it found wrong with them or
# with those of the backups it builds on (messages, operations.utils.say); empty: nothing
verified_at = models.DateTimeField(null=True)
damage = models.JSONField(default=list)
class Meta:
ordering = ["-created_at"]