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

feat(vmbackups): a schedule of every VM with a tag

A backup schedule backs up a compute's VMs, chosen VMs, or now every VM
with a tag: those that have it at each run, templates left out, so a VM
given the tag is backed up from the next day on. The form checks the
target's pools on the hosts of the tag's VMs now; a VM tagged later on a
host without one fails its run with that reason, as a compute's new VM
does. The schedules list says "VMs tagged prod".

A tag a schedule uses is not deleted: the Tags page says which schedules
back up its VMs.
This commit is contained in:
catborise 2026-11-18 21:31:39 +03:00
parent a492031d12
commit f8cb6f1e0f
15 changed files with 157 additions and 46 deletions

View file

@ -61,6 +61,16 @@ class TagAdminTests(TestCase):
self.client.post(reverse("admin:tag_update", args=[self.prod.pk]), {"name": "PROD"})
self.assertEqual(self.messages(), [])
def test_a_tag_a_backup_schedule_uses_is_kept(self):
import datetime
from vmbackups.models import BackupPolicy, BackupTarget
BackupPolicy.objects.create(name="nightly", target=BackupTarget.objects.create(name="nfs"), tag=self.prod,
time=datetime.time(2), keep=3)
response = self.client.post(reverse("admin:tag_delete", args=[self.prod.pk]), follow=True)
self.assertContains(response, "The backup schedule nightly backs up its VMs")
self.assertTrue(Tag.objects.filter(name="prod").exists())
self.assertEqual(self.messages(), [])
def test_only_superusers(self):
self.client.force_login(User.objects.create_user("tg-user", password="pw"))
for url in (reverse("admin:tag_list"), reverse("admin:tag_update", args=[self.prod.pk]),