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

fix(vmbackups): third audit: retention keep, target changes, import

- A retention deletion checks the schedule's keep and later dependants
  once the target is reached, right before deleting: keep raised while
  the target connection waited no longer loses the backup.
- Pool and target changes on the target page take the target claim, so
  an import or backup running into the target keeps the pools it uses.
- Import reads a manifest only with its definition and a disk; an
  unreadable manifest is skipped and listed, the others are imported.
- The backups list shows 50 a page and keeps its filter across pages.
This commit is contained in:
catborise 2026-11-18 08:29:22 +03:00
parent 558eec527c
commit bd5d42e65a
7 changed files with 134 additions and 29 deletions

View file

@ -130,6 +130,27 @@ class ImportTests(TransactionTestCase):
self.assertEqual(result["added"], 1)
self.assertIn(f"wvc-{self.a}-manifest.json", result["warning"][0]["values"]["names"])
def test_a_manifest_without_its_definition_or_disks_is_not_read(self):
empty = manifest(self.a)
empty["files"] = []
self.files[f"wvc-{self.a}-manifest.json"] = json.dumps(empty).encode()
result = self.read()
self.assertEqual(result["added"], 1) # only b
self.assertIn(f"wvc-{self.a}-manifest.json", result["warning"][0]["values"]["names"])
def test_an_unreadable_manifest_does_not_stop_the_others(self):
real = self.files.copy()
def get(conn, pool, name):
if name == f"wvc-{self.a}-manifest.json":
raise libvirt.libvirtError("Permission denied")
return real[name]
with patch("vmbackups.jobs.get_file", side_effect=get):
result = self.read()
self.assertEqual(result["added"], 1)
self.assertIn(f"wvc-{self.a}-manifest.json", result["warning"][0]["values"]["names"])
def test_an_incremental_backup_without_its_base_is_incomplete(self):
lonely = manifest(self.a)
lonely["parent"] = str(uuid4())