mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 17:36:05 +00:00
feat(vmbackups): VM owners back up and restore their VMs within a quota
A permission 'Can back up instances' lets a user back up the VMs they may change into targets open to VM owners, restore those backups over the VM or as a new VM, and delete the backups they took by hand. Each job checks the rights at admission and again when it runs. - A backup quota (GiB, in the user's quota) counts the owner's own backups: a backup being made holds its estimate, what its disks and the files below them hold. An owner's backups run one at a time, so each run's check sees the others. - An owner restores as a new VM on the VM's compute, into its first disk's pool, within the VM quota; the job counts in it until its VM is recorded, as a clone does. - An owner's restore over the VM removes the disks it ran from once the switch is done, unless another VM uses them: the owner cannot remove them. - Recovery never begins a deletion the job had not begun. Superusers keep everything they had.
This commit is contained in:
parent
1b0a54e3d1
commit
db4cbf806a
22 changed files with 1155 additions and 520 deletions
26
vmbackups/migrations/0005_owners.py
Normal file
26
vmbackups/migrations/0005_owners.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# Generated by Django 5.2.18 on 2026-11-17 16:04
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('vmbackups', '0004_incremental'),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='backup',
|
||||
name='taken_by',
|
||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='backuptarget',
|
||||
name='owners',
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue