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

42 commits

Author SHA1 Message Date
catborise
2c0855cf64 feat(backups): a schedule also keeps weekly and monthly backups
Besides the newest N backups of each VM, a schedule keeps the newest backup
of each of the last N weeks and of the last N months that have one (panel
time zone); 0 keeps none. The schedules list shows them.
2026-11-19 22:28:44 +03:00
catborise
adb4231db7 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.
2026-11-19 22:00:25 +03:00
catborise
7b23c75bf5 fix: the API verifies a backup and shows what was found; Docker's health check reads /healthz
The backups API had every backup action but Verify, and did not show a
backup's verified_at and damage: a script restoring through it got no sign
of a damaged chain. Docker's health check asked for the login page, so a
hung job worker left the container healthy; it now reads /healthz.
2026-11-19 21:03:54 +03:00
catborise
fc6ad4e8ca fix(backups): a verification marks each damaged backup of the chain; an error told once
Verifying an incremental backup put what it found only on that backup: a
base whose file was changed or missing stayed unmarked, so restoring it
gave no warning and no badge showed it. Each backup of the chain is now
verified with it and holds the damage of its files and of those it builds
on. Verifications of backups of one chain run one at a time, so an older
read never writes over a newer finding; the rows and the job's own result
are written together, and recovery reads that result, also when a cancel
came after the reads.

A job whose recovery found the error it had raised stored it twice (the
verify job's damage, in its page and its alert).
2026-11-19 19:12:02 +03:00
catborise
2c8493ba8c fix: a test alert button; damage shown and warned of on restore
Audit of the alerts and backup verification: an operator could learn
that the alert mail or webhook works only from a real failure. Settings
> Alerts gets "Send a test alert", sent at once to the channels saved,
each channel's result shown. A damaged backup's reasons were only in a
tooltip, so not on a touch screen: they show under the badge. A restore
of a backup that a verification found damaged, or of an incremental on
a damaged base (shown as Ready), said nothing: the restore pages warn.
2026-11-19 17:24:18 +03:00
catborise
dcd7e32df7 feat(alerts): mail and webhook alerts, and /healthz for a monitor
A failed backup, a scheduled backup not taken, backups the daily check
finds missing and a job that ends uncertain could only be seen on the
pages. They are now queued as alerts in the transaction of the change
they tell of (never stopping it) and sent by the worker's periodic pass
to the Settings page's alert e-mail addresses (the server's SMTP
settings) and alert webhook (a JSON POST), each tried again for ten
passes on its own. A skip for a host in maintenance is no alert.
Setting values take 255 characters. /healthz answers 200 while the
database answers and the job worker runs, 503 otherwise, without a
login.
2026-11-19 16:10:37 +03:00
catborise
2cf7dbe577 feat(backups): verify a backup's files on demand
The daily target check only finds files that are gone. Verify (a ready
backup's Restore menu, superusers) runs backup.verify: it reads the
backup's files and those of the backups it builds on whole from the
target through a libvirt stream: each there, a disk at its size and in
its format on its base's file, the small files with their SHA-256, and
a disk with the SHA-256 recorded at its first verification. What is
wrong is kept on the backup and shown as Damaged; a target that cannot
be read fails the job and leaves the backup as it was. Progress in
bytes, cancellable.
2026-11-19 16:10:19 +03:00
catborise
2e3ffba851 fix(backups): a schedule of every VM of a compute reads the host's VMs
The schedule took a compute's VMs from the database, which learns of a
VM made with virsh only when a page reads the host. When its time comes,
the compute's own schedule task reads the host first, once a day per
compute and day; the new VM is backed up a pass later.
refresh_instance_database now says whether it synchronized: a host that
did not answer, was busy or failed is read again at the next pass, and
the known VMs are backed up meanwhile. A host in maintenance is not read.
2026-11-19 15:15:11 +03:00
catborise
f8cb6f1e0f feat(vmbackups): a schedule of every VM with a tag
A backup schedule backs up a compute's VMs, chosen VMs, or now every VM
with a tag: those that have it at each run, templates left out, so a VM
given the tag is backed up from the next day on. The form checks the
target's pools on the hosts of the tag's VMs now; a VM tagged later on a
host without one fails its run with that reason, as a compute's new VM
does. The schedules list says "VMs tagged prod".

A tag a schedule uses is not deleted: the Tags page says which schedules
back up its VMs.
2026-11-18 21:33:41 +03:00
catborise
810abe7475 fix(vmbackups): eighth audit: retention reads each VM once, no reload while typing
- The backups' default ordering put created_at into the SELECT DISTINCT
  of the retention pass and of the checkpoint pruning, so a VM came once
  per backup: the pass read every backup's chain again. The ordering is
  cleared before both.
- A page with a backup being made or deleted reloads every 4 s; it now
  waits while a field is focused, so a filter or the backup form being
  filled in is not lost.
2026-11-18 15:53:18 +03:00
catborise
348628f13d fix(vmbackups): seventh audit: files of a VM named after a backup, restore-over page
- A VM may be named "<another backup's prefix>-x": its backups' files then
  begin with that prefix too, and deleting the other backup removed them.
  Backup.owns() takes a file only when no other backup UUID follows the
  prefix; deletion and the storage pages' refusal use it.
- The restore-over page failed with a server error when the VM's pool
  could not be read while naming the copies; it now says why.
2026-11-18 15:33:30 +03:00
catborise
5b05e76ebc feat(vmbackups): a backup's file names begin with its VM's name
Someone looking at the target's directory could not tell whose backup a
file was without opening its manifest. A new backup's files are named
<vm>-<backup uuid>-<file> (the VM's name made safe for a file name, at most
64 characters). The prefix is kept on the row: backups made before keep
their wvc-<uuid> names (migration 0007), and an import takes it from the
manifest's file name. Manifests of either naming are found by their
UUID suffix.
2026-11-18 14:57:14 +03:00
catborise
8e0a84a3bd fix(vmbackups): full audit: backup volumes attached, ended creates, refusals
- A backup's volume is no longer attached to a VM as an existing volume:
  the VM would write into the backup, and the backup's deletion (by hand
  or retention) would remove the VM's disk.
- A backup whose create job ended without it (uncertain, then resolved)
  stayed "creating" for good and could not be deleted. Only a backup whose
  job still runs is being made; the others show as failed and are deleted.
- A VM with an NVDIMM or virtio-pmem device is refused: the host file
  behind it is not copied, and its restore would use the original's file.
- A block device's or network NVRAM is refused by its path, instead of a
  ready backup without the firmware state.
- A VM owner's restore pages link back to the VM's Backups tab, not to the
  superusers' backup list.
2026-11-18 14:30:51 +03:00
catborise
e1611efd53 fix(vmbackups): a schedule run's failure reason in the reader's language
A failed run kept the error as English text and the schedule page passed
the whole sentence to gettext, which found no catalog entry once values
were filled in. The run now keeps the error as messages (text and values),
as jobs do, and the page shows them with the new words filter.
2026-11-18 14:05:38 +03:00
catborise
fb6a427a47 fix(vmbackups): a backup restored over its VM again takes the next free name
The copies were named from the VM, the disk and the backup's minute only.
Restoring the same backup over the VM a second time, or a second backup
of the same minute, chose the name of the disk the VM already ran from,
and the job refused it. The names are now chosen at submission, numbered
from 2 when the pool has one, and kept in the job's intent apart from the
VM state the job checks again before and after the copies.
2026-11-18 14:05:38 +03:00
catborise
8cd7aee19a fix(vmbackups): an incremental backup needs room for its changed blocks only
The target space check asked for every disk's virtual capacity even when
the backup copies only the blocks changed since its parent. The checkpoint
already reports those bytes per disk (VIR_DOMAIN_CHECKPOINT_XML_SIZE), so
checkpoint_usable becomes checkpoint_sizes and the check runs after the
parent is chosen, with the changed bytes for an incremental backup and the
capacity for a full one. The margin (free_percent, free_min_gib) is kept.
2026-11-18 13:38:27 +03:00
catborise
132676a772 fix(vmbackups): fifth audit: offline copies, domain file mode, target check
- An offline backup is not published when the VM was started while its
  disks were copied (its NVRAM and TPM state would be newer than the
  disks); recovery does not publish it either.
- A cancel asked during the last disk of an offline copy is honoured:
  the copies are removed instead of the backup being published.
- The backup's domain definition is written 0600, as the TPM state is:
  it holds the graphics passwords.
- The daily target check does not mark missing a backup finished in the
  last 10 minutes: written through another compute, its files may not
  be listed yet by this one's NFS client.
2026-11-18 12:19:13 +03:00
catborise
57d4b61c6e fix(vmbackups): fourth audit: missing incrementals, VM row changes
- Retention counts keep in ready backups only and also deletes the
  missing ones older than the oldest kept: an incremental whose files
  were lost no longer pins its chain on the target forever.
- When another row takes a VM's place (a migration the destination's
  VM list recorded first, or a move found by a sync), its backups,
  schedule membership and today's schedule runs move with its owners:
  owners keep their backups, retention and restore over still see
  them, and the VM is not backed up twice that night.
2026-11-18 10:06:52 +03:00
catborise
bd5d42e65a fix(vmbackups): third audit: retention keep, target changes, import
- A retention deletion checks the schedule's keep and later dependants
  once the target is reached, right before deleting: keep raised while
  the target connection waited no longer loses the backup.
- Pool and target changes on the target page take the target claim, so
  an import or backup running into the target keeps the pools it uses.
- Import reads a manifest only with its definition and a disk; an
  unreadable manifest is skipped and listed, the others are imported.
- The backups list shows 50 a page and keeps its filter across pages.
2026-11-18 08:29:22 +03:00
catborise
df11685037 fix(vmbackups): second audit: a frozen guest, refused copies, stuck deletes, lists
Codex's audit of the module, each fix tested:
- a backup cancelled while its guest stayed frozen ends through recovery,
  which thaws the guest first, not as a cancel that never thaws it;
- a restore copy libvirt refuses fails and removes the copies, instead of
  waiting on an administrator as an unknown outcome;
- a deletion that did not end can be asked again from the page;
- recovery starts a restored VM the restore was asked to start;
- a manifest with a bad UUID no longer stops reading the target's others;
- an owner is not linked to a job only its submitter or a superuser opens.

From the browser audit: with a long VM name the backup list pushed the
state and the actions out of view, and on a phone only the time and VM
showed. The list folds the target under the time and the schedule under
the VM, cuts long names (whole on hover), shows the restore menu as an
icon on a phone, and fits from 390 px up. An owner without a backup quota
is told so, and quota sizes never read 0.0 GiB.
2026-11-18 07:29:36 +03:00
catborise
adcf881028 fix(vmbackups): schedules and targets are added on a page of their own
The schedule and target lists kept their add forms open below the table,
a long form always in the way. Each list now has a 'New schedule' or 'New
target' button at its top right that opens the form on its own page,
with Cancel; saving goes back to the schedule list, or to the new target,
with a message.
2026-11-17 22:27:45 +03:00
catborise
14ac7eba50 fix(vmbackups): a saved schedule says so; a finished job opens what it made
Saving a new or changed schedule took the user to the schedule's page,
which is its edit form and looked like the form they had just sent: it
seemed nothing was saved. Saving and deleting a schedule now go back to
the schedule list and say so; opening or closing a target to VM owners
says so too.

A finished job's page showed only its state and times: a restore did not
lead to the VM it made. The job page now opens what a job made (its
result's open), for every kind; reading a target's backups opens the
target. The one-disk restore form starts on the VM's host.
2026-11-17 22:06:19 +03:00
catborise
fc87a3034e fix(vmbackups): clearer backup pages; a deletion stays on its page
Deleting a backup took the user to the generic job page, which named
neither the backup nor a way back. The deletion now stays on the page it
was asked from, says which backup is being deleted, shows the row as
being deleted and reads the page again until it is gone. The confirm
dialog is 'Delete backup' and names the target and that it cannot be
undone; the job's label names the VM and the backup's time.

The lists keep a VM's and a target's name and a row's actions on one
line, link a backup's job only when it is being made (Progress) or failed
(Why?), and say 'While shut off' for an offline backup. The schedule form
puts the full-backup setting on a row of its own and the schedule list
shows it; the restore form starts on the VM's host.
2026-11-17 20:14:12 +03:00
catborise
43d25a2759 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.
2026-11-17 19:40:33 +03:00
catborise
db4cbf806a 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.
2026-11-17 19:40:24 +03:00
catborise
1b0a54e3d1 feat(vmbackups): the schedule form sets how often a backup is full
The schedule form gains 'A full backup every N backups' (1: every backup
is full), and the backup lists mark incremental backups. The README says
which backups are incremental and what makes the next one full.
2026-11-17 17:12:05 +03:00
catborise
d856ccca68 feat(vmbackups): restore, delete, retention, check and import know chains
An incremental backup is restored by copying its chain flat: every base's
disk file is checked first, as the backup's own, and a chain whose base's
row is gone is refused. A backup that a living backup builds on is not
deleted, by hand or by retention: retention deletes a chain only once all
of it is beyond keep, newest first; a failed backup holds no base. The
target check marks a backup missing when a base's file is gone. Reading a
target links each incremental backup to its base, read first, and leaves
one without its base unread. Restoring over the VM forgets its
checkpoints: its disks are replaced, and the next backup is full.
2026-11-17 17:12:05 +03:00
catborise
72e270a87e feat(vmbackups): incremental scheduled backups of running VMs
A schedule with 'a full backup every N backups' above one makes a
checkpoint with each running VM's backup. The next builds on the
schedule's newest ready backup: the changed blocks are pushed into qcow2
volumes made with the base's file as backing file, by its name, as the
target pool's directory differs per host. The base is used only when its
chain is shorter than N, its disks are the VM's, every file of the chain
is in the target, and its checkpoint has a sized bitmap for every disk;
otherwise the backup is full and starts a chain.

Before each scheduled backup of a running VM, the VM's backup
checkpoints are pruned to each schedule's newest base. A checkpoint
libvirt no longer lists, as after a migration, is redefined first so
that its bitmap goes too.

A shut-off VM's backup checkpoints are forgotten before its external
snapshot: libvirt 11.10 makes no offline external snapshot while a
checkpoint exists. The next scheduled backup is then full.
2026-11-17 17:12:05 +03:00
catborise
44aa7afe04 feat(vmbackups): pages and API for restoring over the VM and one disk
A ready backup's Restore button becomes a menu: as a new VM, over the VM
(offered when the backup has its VM row) and one disk. Restoring over the
VM shows each disk's volume now and the new one before it is confirmed,
and why not when it cannot be done. The API gains restore-over and
restore-disk actions, answered 202 with the job.
2026-11-17 16:10:17 +03:00
catborise
e2335be21f feat(vmbackups): restore one disk of a backup as a new volume
One disk of a ready backup is copied as a new volume into a pool of a
compute that has the target's pool, attached to no VM. A copy that ended
before the worker stopped succeeds in recovery; one whose answer is
unknown is left uncertain.
2026-11-17 16:10:11 +03:00
catborise
5010e3a51c feat(vmbackups): restore a backup over its own shut-off VM
The VM's disks are copied from the backup as new volumes beside the old
ones, which stay until removed by hand. Then the switch, recorded first and
finished by recovery: the NVRAM file and the TPM state are replaced by the
backup's, and the VM's own definition points at the copies with a new
generation ID. Its devices, MACs and UUID stay. A VM that is not shut off,
has snapshots or a saved state, or whose disks, UEFI firmware or TPM are
not the backup's, is refused; the checks run again before the switch.
2026-11-17 16:10:11 +03:00
catborise
da52a23ed8 feat(vmbackups): restore a backup's TPM state
The restore writes the backup's TPM state files into libvirt's swtpm
directory of the new VM's UUID before the VM is defined; libvirt makes
them swtpm's when the VM starts and keeps the state, so the guest keeps
its TPM identity. A file name from a manifest that is not a plain name is
refused before anything is made, a host without swtpm is refused, and
recovery of a restore that did not define its VM removes the files.
2026-11-17 13:55:16 +03:00
catborise
52b6096efe feat(vmbackups): back up a shut-off VM's TPM state
A VM with the panel's emulated TPM 2.0 is backed up when it is shut off:
each state file of libvirt's swtpm directory for the VM, read through a
transient pool on it, becomes a small file of the backup (role tpm),
written and read back like the NVRAM file. A running or paused VM with a
TPM is refused, and so is a TPM with its own settings (encryption, a
state path, another backend). The manifest says whether the TPM state was
copied or never written.
2026-11-17 13:54:12 +03:00
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
819cdada69 feat(vmbackups): schedules back VMs up daily, keep the newest, check targets
The worker's periodic pass (about once a minute) runs the schedules:

- Each enabled schedule's VMs are backed up once a local day, from the
  schedule's time for 6 hours, as its owner. A late time's window goes
  on after midnight; a time a spring-forward gap skips falls an hour
  later, a repeated autumn time is its first. A run row per schedule,
  VM row and day, and a submission key made from them, keep a worker
  that stopped between the job and its row from backing a VM up twice.
- A busy target (one copy at a time) or an unreachable host is tried
  again at the next pass; a host in maintenance is waited for. A VM not
  started within the window, a VM that cannot be backed up (TPM) and a
  schedule whose owner is no longer an active superuser get a run row
  saying why. Times passed before a schedule was made are not run.
- Each compute's submissions are a task of their own: a hung host stops
  no other compute's schedules.
- Retention: each schedule's ready backups of a VM beyond keep, oldest
  first, one deletion a target at a time. The deletion checks again,
  before it changes anything, that the backup is still beyond keep.
  Backups by hand and backups of removed VMs are left alone.
- Each target is checked once a day by a backup.check job holding it: a
  ready backup with a file gone, its manifest included, becomes missing
  (restore refused, delete allowed); one whose files are back is ready
  again. A pool no compute reaches marks nothing.
- A scheduled backup carries the end of its window: one that waited
  past it for a worker slot, or whose host went into maintenance
  meanwhile, ends without starting (checked after the host answered).

The jobs on a target alone (delete, read back, check) hold its computes
too, shared: the worker counts a job's hosts by these, so a hung host
takes no more than its share of the slots.
2026-11-17 11:38:31 +03:00
catborise
1219a37cc4 feat(vmbackups): backup schedules' records; the worker runs the apps' periodic tasks
A backup schedule (BackupPolicy) names its VMs, chosen or every VM of a
compute at the time it runs (templates left out), a target, a daily time
in the panel's time zone, how many backups of each VM to keep (one at
least), whether frozen file systems are required, and the superuser its
jobs run as. A run (BackupRun) records one VM's backup of one day, keyed
by the VM's row, not its UUID, which two VM rows may share. A backup
keeps the schedule that made it; deleting the schedule keeps its
backups. A backup whose files are gone can be marked missing, and a
target keeps when it was last checked.

The worker runs the tasks apps register with register_periodic about
once a minute, on a thread of their own, one pass at a time, each
guarded: a pass stuck on a host takes no thread recovery or a cancel
needs, and one failing task stops none of the others. Nothing registers
one yet.

backup.create takes the schedule that asked for it; one deleted while
the job was queued leaves the backup without a schedule.
2026-11-17 10:18:04 +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
catborise
c7d6f90823 feat(vmbackups): the backups app and its records
A new app holds VM backups: a backup target (a storage pool on each
compute that sees it, its UUID kept to refuse a replaced pool), the
backups (kept with the VM's name and UUID when the VM row goes) and their
files. Claim keys for a target and a backup. Nothing uses them yet.

Installs with their own settings.py add "vmbackups" to INSTALLED_APPS.
2026-11-17 07:32:35 +03:00