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

fix(computes): a VM that returns gets its protection, schedules and backups back

A VM that vanished from its compute, or whose compute was deleted and added
again, came back with its owners and tags only: it was no longer protected,
its schedules no longer backed it up, and its backups stayed unlinked, so its
Backups tab no longer listed them and retention left them for good. The
Removed VMs record now keeps its protection, its schedules and its own
backups (not those of a copy under the same UUID), and gives them back.
Turning protection on or off waits for the ownership step, so a VM dropped
from its host's list meanwhile is not told protected.
This commit is contained in:
catborise 2026-11-20 07:55:26 +03:00
parent 5c7687c60d
commit dc5b1dbb2a
14 changed files with 251 additions and 138 deletions

View file

@ -462,7 +462,7 @@ def tombstone_delete(request, pk):
request,
"common/confirm_delete.html",
{"object": tombstone,
"consequence": _("Its owners and tags no longer come back if its UUID shows up again.")},
"consequence": _("Its owners, tags, protection and schedules no longer come back if its UUID shows up again, nor are its backups linked to it again.")},
)
@ -485,7 +485,7 @@ def _retag_removed_vms(old, new):
tombstone.tags = [new if name == old else name for name in tombstone.tags]
else:
tombstone.tags = [name for name in tombstone.tags if name != old]
if tombstone.tags or tombstone.owners or tombstone.is_template:
if tombstone.keeps_anything():
tombstone.save(update_fields=["tags"])
else: # kept only for the tag (computes.utils._bury)
tombstone.delete()