mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 17:36:05 +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:
parent
5c7687c60d
commit
dc5b1dbb2a
14 changed files with 251 additions and 138 deletions
|
|
@ -410,7 +410,7 @@ class Instance(models.Model):
|
|||
|
||||
|
||||
class InstanceTombstone(models.Model):
|
||||
"""Ownership and tags of a VM that disappeared from its compute.
|
||||
"""Ownership, tags, protection, schedules and backups of a VM that disappeared from its compute.
|
||||
|
||||
Kept for INSTANCE_OWNERSHIP_RETENTION_DAYS so that they come back
|
||||
when the same UUID shows up again, on this or another compute.
|
||||
|
|
@ -420,13 +420,19 @@ class InstanceTombstone(models.Model):
|
|||
name = models.CharField(max_length=255)
|
||||
host = models.CharField(max_length=64, blank=True) # the compute's name: the compute may be deleted
|
||||
is_template = models.BooleanField(default=False)
|
||||
protected = models.BooleanField(default=False)
|
||||
owners = models.JSONField(default=list) # [{"user": id, "is_change": .., "is_delete": .., "is_vnc": ..}]
|
||||
tags = models.JSONField(default=list) # the names: a tag deleted meanwhile is not given back
|
||||
policies = models.JSONField(default=list) # the ids of the schedules that chose it: one deleted is not
|
||||
backups = models.JSONField(default=list) # the ids of its backups: not a copy's under the same UUID
|
||||
removed = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
def __str__(self):
|
||||
return "%s (%s)" % (self.name, self.uuid)
|
||||
|
||||
def keeps_anything(self):
|
||||
return bool(self.owners or self.is_template or self.protected or self.tags or self.policies or self.backups)
|
||||
|
||||
|
||||
class PermissionSet(models.Model):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue