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

feat(instances): a protected VM is not deleted nor restored over

A superuser turns a VM's protection on or off on its Settings tab, not while
a job holds the VM (a deletion or a restore over it that runs would not
stop). While it is on, its deletion (page, API, a queued job at its start)
and a restore of a backup over it are refused; the Destroy tab, the destroy
page and the restore page say so. A VM moved outside the panel keeps it.
The API shows the flag read-only.
This commit is contained in:
catborise 2026-11-19 21:45:57 +03:00
parent 57e90e0d27
commit adb4231db7
21 changed files with 706 additions and 491 deletions

View file

@ -33,6 +33,8 @@ class Instance(models.Model):
name = models.CharField(_("name"), max_length=255, db_index=True)
uuid = models.CharField(_("uuid"), max_length=36, db_index=True)
is_template = models.BooleanField(_("is template"), default=False)
# not deleted nor restored over until a superuser turns it off (instances.jobs.unprotected)
protected = models.BooleanField(_("protected"), default=False)
created = models.DateTimeField(_("created"), auto_now_add=True)
drbd = models.CharField(_("drbd"), max_length=24, default="None")
tags = models.ManyToManyField("computes.Tag", blank=True, related_name="instances", verbose_name=_("tags"))