mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 01:16:10 +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:
parent
8e0a84a3bd
commit
5b05e76ebc
8 changed files with 81 additions and 33 deletions
|
|
@ -51,8 +51,9 @@ class BackupModelTests(TestCase):
|
|||
self.assertIsNone(self.target.pool_on(self.compute))
|
||||
|
||||
def test_prefix(self):
|
||||
backup = Backup(uuid=UUID("00000000-0000-4000-8000-000000000001"))
|
||||
self.assertEqual(backup.prefix, "wvc-00000000-0000-4000-8000-000000000001")
|
||||
target = BackupTarget.objects.create(name="nfs-p")
|
||||
backup = Backup.objects.create(uuid=UUID("00000000-0000-4000-8000-000000000001"), target=target, vm_name="web 01")
|
||||
self.assertEqual(backup.prefix, "web_01-00000000-0000-4000-8000-000000000001")
|
||||
|
||||
def test_claim_keys(self):
|
||||
self.assertEqual(backup_target_key(3), "backup_target:3")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue