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

feat(vmbackups): the Backups tab and restore pages for VM owners

A VM owner with the backup permission who may change the VM gets its
Backups tab: the targets open to VM owners, the VM's backups on them,
Restore as a new VM or over the VM, and Delete for the backups they took;
no schedule is shown. Their restore as a new VM names the VM's host and
pool instead of asking, and the restore-over page says that the disks the
VM runs from are deleted. A superuser opens or closes a target to VM
owners on its page.
This commit is contained in:
catborise 2026-11-17 19:32:22 +03:00
parent db4cbf806a
commit 43d25a2759
15 changed files with 500 additions and 300 deletions

View file

@ -41,10 +41,12 @@ class RestoreForm(forms.Form):
"connected beside the VM, they clash."))
start = forms.BooleanField(label=_("Start after restore"), required=False)
def __init__(self, *args, backup, **kwargs):
def __init__(self, *args, backup, place=None, **kwargs):
super().__init__(*args, **kwargs)
self.fields["compute"].queryset = Compute.objects.filter(backuptargetpool__target=backup.target).order_by("name")
self.fields["name"].initial = f"{backup.vm_name}-restored"
if place: # a VM owner's: the VM's compute and pool, shown on the page
del self.fields["compute"], self.fields["pool"]
class RestoreDiskForm(forms.Form):