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

@ -505,6 +505,12 @@ def tag_update(request, pk):
@superuser_only
def tag_delete(request, pk):
tag = get_object_or_404(Tag, pk=pk)
schedules = list(tag.backup_policies.values_list("name", flat=True))
if schedules: # it would back up nothing (models.PROTECT)
messages.error(request, ngettext("The backup schedule %(schedules)s backs up its VMs: change it first",
"The backup schedules %(schedules)s back up its VMs: change them first",
len(schedules)) % {"schedules": ", ".join(schedules)})
return redirect("admin:tag_list")
if request.method == "POST":
with audit(request, None, f"Tag {tag.name}", "delete"), transaction.atomic():
lock_ownership()