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

feat(vmbackups): backup targets: a storage pool per host, checked to be one directory

A backup target is a dir or NFS storage pool the administrator makes on
the hosts and registers on the new Backup targets page (Backups in the
menu, superusers only). Each compute's pool is kept with its UUID, so a
pool replaced by another of the same name is refused. A second compute's
pool is accepted only when it is the same directory as the target's
first (the exclusive-create check migrations use). The target page shows
each pool's space and warns when the target is inside another pool's
directory, as its backups would share that storage's failures.

The storage pages refuse to delete a target's pool, and a volume of a
backup (page and API): backups are deleted from the Backups pages.
This commit is contained in:
catborise 2026-11-17 07:36:56 +03:00
parent c7d6f90823
commit 022737f143
17 changed files with 821 additions and 54 deletions

View file

@ -13,6 +13,7 @@ from logs.audit import audit, failed
from rest_framework import serializers, status, viewsets
from rest_framework.decorators import action
from rest_framework.response import Response
from vmbackups.utils import refuse_backup_volume
from vrtManager.storage import wvmStorage, wvmStorages
from webvirtcloud.serializers import ErrorSerializer, StatusSerializer
@ -208,6 +209,7 @@ class VolumeViewSet(viewsets.ViewSet):
subject, action = f"Storage pool {storage_pk}", f"delete volume {pk}"
if conn.is_active():
with audit(request, compute, subject, action):
refuse_backup_volume(compute, storage_pk, pk)
conn.check_unused_elsewhere(pk, lambda paths: paths_used_on_other_computes(compute, paths))
# no VM operation attaches it between the check and the delete
with libvirt_compute_lock(compute):