1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-02 17:06:09 +00:00
Commit graph

6 commits

Author SHA1 Message Date
catborise
a145c07601 feat(vmbackups): the Schedules pages
Backups -> Schedules lists the backup schedules and adds one: a name, a
target, every VM of a compute or chosen VMs (a searchable list), a
daily time in the panel's time zone (the form names it), how many
backups of each VM to keep, Require frozen file systems, Enabled. The
VMs' hosts must have a pool of the target. The superuser who saves a
schedule is its owner, whom its jobs run as. A schedule's page edits or
deletes it (its backups are kept) and lists its runs: the backup job,
or why the day's backup was skipped or failed.

The Backups page has a Schedule column (or By hand) and a Missing state;
a missing backup offers no Restore. A VM's Backups tab names the
schedules that cover it. README: a paragraph on schedules.

A target with schedules is not deleted: its page says to delete them
first.
2026-11-17 11:38:35 +03:00
catborise
1123d7e8e5 feat(vmbackups): read the backups of a target into the panel
Read backups from target, on a backup target's page, is a backup.import
job holding the target: through the first of its computes that reaches
the pool, it reads each manifest whose backup the panel does not list,
checks its files as a restore does (the disks at their size, the small
files by SHA-256), and adds the backup with its files, its time and, when
the panel has that VM, its VM. A manifest with a missing or changed file
is reported incomplete, not added. Nothing on the target changes. A panel
rebuilt after losing its database adds the target again, reads it, and
restores.

README: a VM backups section (what a backup holds, what is not backed
up, what a target must be, an NFS target's virsh commands). Permissions:
backups are superusers'.
2026-11-17 09:14:11 +03:00
catborise
823d34cc18 feat(vmbackups): restore a backup as a new VM
A ready backup has a Restore button (Backups page and the VM's tab) and
POST /api/v1/backups/<uuid>/restore/. The form takes the new VM's name
(default <vm>-restored), a compute that has the target's pool, the pool
for its disks, Connect the network (off by default: the restored guest
keeps the VM's addresses and host name) and Start after restore. The job
page follows the restore.

The backup.restore job holds what a new VM's job holds, the backup
(shared) and the target. Before anything is made it checks again: the
host is not in maintenance; the name is free in the panel and on the
host (a VM made with virsh too); the backup's files are in the target,
the disks at their size and the small files with their SHA-256; the
host offers the definition's emulator, machine type and firmware, its
networks, bridges and network filters; the destination pool has room
and none of the copies' names. The new VM's UUID, MACs, volume names and
NVRAM path are recorded first. Then the disks are copied from the
target, the NVRAM file uploaded, maintenance checked once more, and the
VM defined last and given to the superuser who restored it.

The definition is the kept one rewritten as a clone's (rewrite_for_new_vm,
taken out of _clone_definition for both): new name, UUID and SMBIOS
UUID, MACs and filter parameters, a VNC password, no cloud-init seed of
the VM's; with a new generation ID, each disk's source the restored file
without the old chain, the NVRAM path, and links down unless connected.

Recovery records a VM defined by the recorded UUID; otherwise it removes
the copies and the NVRAM file by their recorded names.
2026-11-17 09:14:09 +03:00
catborise
7227867d78 feat(vmbackups): delete a backup; the Backups page
Backups in the menu now opens a page of every backup, newest first,
filtered by VM name, target and state; a removed VM's backups are
marked. Each backup, there and on the VM's Backups tab, has a Delete
button (also DELETE /api/v1/backups/<uuid>/, 202 with the job).

The backup.delete job holds the backup and its target. Through the
first of the target's computes that reaches its pool, it marks the
backup deleting, removes the manifest first, so the target no longer
holds a complete backup, then every other file named from the backup's
UUID (also those a failed backup left), then the row. Recovery runs the
same steps again. A backup being made is refused: its job is cancelled
instead.

States and consistency are shown in the reader's language.
2026-11-17 09:14:07 +03:00
catborise
f4559acbc7 feat(vmbackups): back up a running or shut-off VM into a target
A superuser backs a VM up from its new Backups tab, or with POST
/api/v1/backups/ (202 with the job); GET lists and reads backups. The
backup.create job holds the VM, its compute (shared) and the target, so
migrations, snapshots and power changes of the VM wait meanwhile.

- A shut-off VM's disks are copied one at a time into the target pool,
  flat, in their format (createXMLFrom); a cancel stops before the next.
- A running or paused VM's disks go by libvirt's push backup into
  volumes made first, as the live clone: the file systems frozen for its
  start when the guest agent answers (frozen), crash-consistent
  otherwise, or refused when frozen file systems are required. A guest
  that shuts down meanwhile does not end the backup.
- A running VM's NVRAM file is kept only when it reads the same after
  the copy as before it (three reads), so it is the capture point's.
- Then the NVRAM file, the definition and the manifest (written last)
  are uploaded and read back, and the row becomes ready with its files.
- Recovery thaws a frozen guest first, watches a push backup still
  running, finishes a copied backup, removes the files of a failed or
  cancelled one, and leaves a copy whose end libvirt cannot tell
  uncertain with its files named. The target pool is checked by UUID and
  its free space before anything is made.
2026-11-17 09:13:59 +03:00
catborise
022737f143 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.
2026-11-17 07:40:08 +03:00