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

feat(vmbackups): restore, delete, retention, check and import know chains

An incremental backup is restored by copying its chain flat: every base's
disk file is checked first, as the backup's own, and a chain whose base's
row is gone is refused. A backup that a living backup builds on is not
deleted, by hand or by retention: retention deletes a chain only once all
of it is beyond keep, newest first; a failed backup holds no base. The
target check marks a backup missing when a base's file is gone. Reading a
target links each incremental backup to its base, read first, and leaves
one without its base unread. Restoring over the VM forgets its
checkpoints: its disks are replaced, and the next backup is full.
This commit is contained in:
catborise 2026-11-17 17:03:45 +03:00
parent 72e270a87e
commit d856ccca68
12 changed files with 555 additions and 391 deletions

View file

@ -112,6 +112,10 @@ class Backup(models.Model):
class Meta:
ordering = ["-created_at"]
def depended_on(self):
"""Whether a backup builds on this one: a failed one holds nothing."""
return self.children.filter(state__in=(self.CREATING, self.READY, self.MISSING, self.DELETING)).exists()
@property
def prefix(self):
"""Every file of the backup in the target is named from its UUID only."""