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

feat(vmbackups): a backup's file names begin with its VM's name

Someone looking at the target's directory could not tell whose backup a
file was without opening its manifest. A new backup's files are named
<vm>-<backup uuid>-<file> (the VM's name made safe for a file name, at most
64 characters). The prefix is kept on the row: backups made before keep
their wvc-<uuid> names (migration 0007), and an import takes it from the
manifest's file name. Manifests of either naming are found by their
UUID suffix.
This commit is contained in:
catborise 2026-11-18 14:57:14 +03:00
parent 8e0a84a3bd
commit 5b05e76ebc
8 changed files with 81 additions and 33 deletions

View file

@ -98,6 +98,7 @@ class ImportTests(TransactionTestCase):
self.assertEqual((backup.state, backup.target, backup.instance, backup.vm_name, backup.consistency),
(Backup.READY, self.target, self.vm, "vm1", "frozen"))
self.assertEqual(backup.created_at.isoformat(), "2026-11-01T10:00:00+00:00")
self.assertEqual(backup.prefix, f"wvc-{self.a}") # its files' names, as the target has them
self.assertEqual(sorted(backup.files.values_list("role", flat=True)), ["disk", "domain"])
self.assertEqual(self.read()["added"], 0)
self.assertEqual(Backup.objects.count(), 2)