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

2362 commits

Author SHA1 Message Date
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
5f7555f348 fix(instances): a VM with backup checkpoints is deleted and moved offline
libvirt refuses to undefine a domain that has checkpoints unless asked to
drop their metadata. The VM delete job and the shut-off migration's
removal of the source definition now pass CHECKPOINTS_METADATA; a backup
chain ends with them, and the next backup is full.
2026-11-17 16:55:26 +03:00
catborise
272260eec5 fix(instances): the VM page's tab bar wraps instead of overflowing
On wide screens the tabs never wrapped (flex-lg-nowrap) and their labels
do not break. With the Backups tab, Turkish labels and the united theme's
wider font, they ran past the card's right edge between 992 and 1199 px.
They now wrap to a second row when they do not fit.
2026-11-17 16:29:42 +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
89835f2b06 feat(vmbackups): what a VM's backup holds and the target files
wvmBackup.backup_plan reads a VM's persistent definition and says what a
backup copies: each file disk (qcow2 or raw) with its pool and virtual
size, the NVRAM file, and what is left out (CD-ROMs, floppies). It
refuses, naming the reason, what a backup could not restore as it is:
encrypted, block, network, volume, directory and shareable disks, other
disk formats, a disk in no storage pool, shared host directories, a
kernel file boot, host devices, a saved state, TPM state (a later
layer), an NVRAM file outside libvirt's directory, and a running VM
whose disks change at its next start.

The target side: the files' names from the backup's UUID only, the free
space check (virtual size plus the snapshots' margin), small files
written and read back with their SHA-256, read, removed and the
manifests listed. download_volume is taken out of copy_nvram for both.
Every user of the NVRAM pool runs in the worker, so its process lock
holds.

A push backup target of a raw disk (live backup or live clone) is made
without qcow2's compat and features, which libvirt refuses for raw.
2026-11-17 08:40:06 +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
catborise
a03f12aa5b fix(computes): maintenance read at the moment of the action; autostart named and refused
An audit of host maintenance found:
- refuse_start and refuse_new_vms trusted the compute as the page or job had
  read it: a clone started after its host went in maintenance during the disk
  copy, and a power-on raced the switch while host devices were checked. They
  now read the state from the database, and power-on checks right before the
  start; a VM defined from XML is refused as well.
- libvirt starts autostart VMs itself when the host boots. Autostart cannot
  be turned on for a VM of a host in maintenance, and the host page names the
  VMs that would start, so that their autostart is turned off before a reboot.
- The New VM dialog said "In maintenance" for a host whose maintenance was
  only requested: it now says "Maintenance".
- Tests now cover the owner's power-on, the revert job and a stale compute.
2026-11-16 22:53:42 +03:00
catborise
80e68d0628 fix(computes): a host's maintenance shows only its own bulk migration; the panel's refusals are not libvirt errors
The host page in maintenance showed the host's latest bulk migration even
when it was from before the maintenance, as a job of the morning that
"succeeded" while a VM still ran. The host now keeps when it went in
maintenance (maintenance_since; a job that puts it there sets it to the
job's own time), and the page shows a bulk migration from then on, or one
still running.

A refusal of the panel's own (OperationError), such as a VM start on a
host in maintenance, was shown as "libvirt Error - ...": it is shown as is.
2026-11-16 20:30:54 +03:00
catborise
d96fe940e9 feat(computes): putting a host in maintenance migrates its VMs; ready once none runs
A host was put in maintenance with its VMs still on it, and emptying it was
a separate step. "Put in maintenance" on a host with VMs that run now opens
Bulk Migrate, whose button migrates the chosen VMs and puts the host in
maintenance in one transaction: with the job admitted, or not at all; a
form sent again finds its job and does not put back a host taken out of
maintenance since. The page also puts it in maintenance without migrating,
for VMs that cannot move or when no host can take them.

Maintenance is not refused while VMs run: it must be on before they move,
or a new VM or Balance could take their place. The host shows instead
whether it is ready: "Maintenance requested" while VMs other than shut-off
ones remain on it (or it cannot be read), with its bulk migration's state;
"In maintenance" once none does. None of its VMs starts or resumes there
meanwhile. Ending maintenance during the bulk migration lets it go on.
2026-11-16 17:04:06 +03:00
catborise
22362de068 feat(computes): a host in maintenance takes no new VM or migration
After a host was emptied with Bulk Migrate for its maintenance, Balance
proposed moving VMs back onto it, and new VMs and migrations could still be
sent there. A superuser now puts a host in maintenance on its page (and
takes it out), each change audited; the form names the state it sets, so a
second page sent meanwhile does not turn it back.

A host in maintenance (Compute.maintenance, refuse_new_vms):
- takes no migration: migration_target refuses it, so the Migrate tab,
  Bulk Migrate, Balance and queued migrate jobs follow one rule; Bulk
  Migrate leaves it out of its destinations and its spread;
- takes no new VM: the create and clone jobs refuse it when asked for and
  again before they start (the REST API submits the same jobs); the create
  pages and the XML define send the user back to the VM list, and the New VM
  dialog lists it without a link;
- is left out of Balance: its VMs neither count nor move, and the Balance
  job refuses a move from it too, before each migration starts.
Its VMs run on; a migration already started finishes. The Computes page and
the host's page show that it is in maintenance.
2026-11-16 15:56:01 +03:00
catborise
070a4b99da feat(computes): Balance and the spread count each host's share of its size
Balance evened out the memory, then the vCPUs, the hosts give their running
VMs, and the Bulk Migrate spread sent a VM to the host with the least
memory: a host twice as large got the same as a small one. Both now count
each host's load against its memory and CPUs: propose lowers the sum of
each host's load squared over its size, least when every host has the same
share; spread sends a VM to the host with the least share after it. With
hosts of one size the proposal is the same as before.

The Balance page shows each host's memory, its CPUs next to the vCPUs, and
the bars as the share of the host's own memory.
2026-11-16 13:41:17 +03:00
catborise
ea20f12bc8 feat(computes): Bulk Migrate spreads a host's VMs over the others; host checks asked once
Bulk Migrate sent every chosen VM to one destination, without looking at
its memory. With several other hosts it now spreads them by default
(computes.balance.spread): the largest VMs first, each to the host that
has the least memory, then vCPUs, with it; a VM that holds its memory
(running or paused) only where it fits the memory the host's running and
paused VMs leave. The page shows where
each VM goes and makes the spread again when a VM is ticked or unticked;
a VM no host has room for says so. One destination stays a choice. The
host.bulk_migrate job takes a destination per VM ("moves").

The Balance and Bulk Migrate pages asked, for every VM and destination,
the host's identity and whether both hosts share each disk directory,
which writes a marker file on the shared storage: about 86 ms a pair,
sequential, so minutes with a few hundred VMs on ten hosts. A Reach
(computes/reach.py) asks each host pair and each directory once and
reads a VM's definitions once. vrtManager: wvmInstances.shares and
file_disks, also used by disk_plan.

read_fleet reads the hosts, their VMs and loads for both pages.
2026-11-16 10:29:07 +03:00
catborise
cf288a54cf fix(computes): the Bulk Migrate page keeps its list and button together
The page showed memory as MiB counts ("16768 MiB"), the destination and
the shut-off switch apart from the list, and a Migrate button below the
whole list that did not say how many VMs it would migrate. Now the list
is one card: "host -> destination" (a choice when there are several) and
the shut-off switch in its header, sizes as on the Computes and Balance
pages, and a footer that stays in sight below a long list with the
number at once and a "Migrate the chosen VMs" button that counts the
ticked VMs and is off while none is.
2026-11-16 09:20:16 +03:00
catborise
54487052e5 fix(computes): Balance moves small VMs rather than a large one for the same balance
The proposal took, step by step, the move that most lowered the sums of
squared loads, so a large VM went first. On a host with an 8 GiB VM and
two small ones it moved the large VM away and a small one back, where
moving the two small VMs evens the hosts out as well.

The proposal is now made twice: once taking the move that lowers the
sums most, once the move that lowers them most for the memory it moves.
The one that evens the hosts out more is taken, and of two that do it as
well, the one that moves less memory.
2026-11-16 09:02:30 +03:00
catborise
1259c11591 fix(computes): the Balance page shows each host's load as bars
The page was a bare table of rounded GiB totals, a footnote shown also
when nothing would move, three tables with their own columns and a
Migrate button far below the list. Now:

- a breadcrumb back to Computes and a one-line description;
- a card per host with its running VMs' memory and vCPUs now and after,
  as bars on one scale, so the imbalance and its fix show at a glance;
- the proposed migrations in one card, "host -> destination" in one
  column, sizes as on the Computes page, and the number at once with a
  "Migrate N VMs" button in its footer;
- the VMs that stay (kept by the user, or unable to move) in one table
  with the reason;
- a success message when the hosts are balanced.

The VM boxes join the proposal's form by their form attribute, so the
migrations' form holds the list.
2026-11-16 08:11:47 +03:00
catborise
4941a8a048 feat(computes): Balance proposes migrations that even out the hosts
A Balance button on the Computes page opens computes/balance/: the memory
and vCPUs each host gives its running VMs, before and after, and the
proposed migrations. The proposal (computes/balance.py) takes, step by
step, the one move that most lowers the sum of the squared memory loads,
then of the squared vCPU loads, and stops when none does; each VM moves
once, and the VMs moved to a host fit in the memory its running and
paused VMs leave without counting those moved away, so the moves may
run in any order. Only running VMs count and
move; one that cannot move (no destination shares its disks) still
counts on its host and is listed with the reason. Unticking a VM keeps
it where it is and makes the proposal again.

Migrate runs the moves shown in one host.balance job. It shares the bulk
migration's loop (computes.jobs.Migrations): migrate jobs, the chosen
number at once, one bulk job at a time. Its migrations take only a
running VM (moveto running_only): one stopped since stays where it is.

A job another one started now shows only on its own page: a host's page
no longer lists a bulk migration's or a balance's migrations, and the
Computes page shows the bulk jobs.
2026-11-16 07:37:10 +03:00
catborise
027896c3d4 fix(computes): a failed bulk migration does not also say it was stopped
The worker hands a failed job that made changes to recovery, whose
outcome joins the job's error. The bulk migration's recovery said "the
bulk migration stopped ... the other VMs stay" after its own "These VMs
did not migrate", as if the worker had left it. A job that ends itself
now records so, and recovery then adds nothing; it still says so for a
job the worker left.
2026-11-15 20:15:54 +03:00
catborise
25e3794cc9 fix(computes): a bulk migration shows as one job on the host's page
The host's VM list showed every migration of a bulk migration as a job
of its own (each holds the host), and kept a card for each when it
ended: 20 VMs, 20 cards down the page. The migrations a bulk migration
starts now name it as their parent, and a page leaves out a job whose
parent is that page's own: the host page shows the bulk migration, with
how many of its VMs are done as its progress; each migration still
shows on its VM's page and the Jobs page. A page also shows the jobs it
is the page of, not only those holding it: the bulk migration holds no
claim on the host.
2026-11-15 20:00:41 +03:00
catborise
60c581e5e1 fix(computes): Bulk Migrate replaces Evacuate, and its list has Select all
The owner found "Evacuate" ("Boşalt") a poor name: the button, page and
job are now Bulk Migrate ("Toplu Taşı"), as Proxmox calls it, and so
are the URL, view, template, script, job kind and claim. The VM list
gets a Select all box in its header, which ticks every VM that can
migrate. The unclear Check button goes: another destination reloads the
list itself, and a host with one destination names it instead of
offering a choice.
2026-11-15 19:43:51 +03:00
catborise
d20254f757 feat(computes): a host evacuates its chosen VMs to another host
The host's Instances page gets an Evacuate button. Its page lists the
host's VMs for a chosen destination: running ones ticked, shut-off ones
left to choose ("Also migrate the shut-off VMs"), and a VM with a disk
file the two hosts do not share refused with the reason, since it needs
a copy chosen on its own Migrate tab.

One "Evacuate host" job migrates them: a migrate job each (live with
auto converge; a shut-off VM offline), at most the chosen number at
once, so a VM that fails stays on the host and the rest go on. The
choice goes up to half the worker's slots, which a host's jobs may take,
less the evacuation's own. Cancelling it cancels the migrations that
run and starts no more. One evacuation runs at a time: it waits in a
worker slot, and several could leave none for their migrations. A VM
that left the host meanwhile is skipped (a migrate job takes the host it
is to leave from the evacuation and refuses another); a host whose record points
elsewhere since, or a worker lowered to one slot, stops it before the
next VM. A busy VM lets the others go first; one an uncertain job holds is
not waited for.

Migrations now hold the hosts' VM sets shared, so several migrate at
once; creates, clones, deletes and the VM list reconcile still wait for
them. A destination gone since the form was shown is refused, not
replaced by another. The uses of the NVRAM directory's pool take turns
(NVRAM_LOCK): two UEFI migrations at once would share a transient pool
that the first destroys under the second.
2026-11-15 18:04:00 +03:00
catborise
c9fef349d5 feat(storages): a volume downloads from its pool page
The volume menu of a pool page gets Download: the host reads the volume
with libvirt's download stream and the panel passes it on in chunks, so
a disk image never sits in the panel's memory. The file is the volume as
stored: a qcow2 volume comes as its qcow2 file. A volume a running VM
uses is refused, as for a copy; the refusal is a message on the pool
page. Each download is a row in the audit log.

gunicorn's worker exits when a request runs past its timeout (600 s), to
end requests stuck on a host. A download of a large disk runs longer, so
each chunk sent starts the request's timeout again: a download that stops
sending is still ended. nginx passes the chunks on as they come
(X-Accel-Buffering: no) instead of spooling them to a file.
2026-11-15 00:31:42 +03:00
catborise
44b6e42f8f fix(storages): a device that holds data says how to erase it
libvirt refuses to build an LVM pool on a device that has a partition
table, a file system or another volume group, with "forced overwrite is
necessary", which the panel cannot do. The refusal now names the device
and the host command that erases it, wipefs -a, after checking that it
is the right device.

The panel does not overwrite the device itself: with an overwrite,
libvirt clears the partition table before it tries the volume group,
even on a disk whose partitions are mounted, so a mistyped device would
lose its partition table.
2026-11-14 23:21:52 +03:00
catborise
690275adb7 refactor(vrtManager): a shut-off VM clone copies its disks with clone_volume
clone_instance built its own volume XML for file disks and for RBD
images, and called clone_volume only for block disks. Each disk now goes
through wvmStorage.clone_volume, in the pool of its source volume.

clone_volume makes the volume under the exact name it is given and
returns its path; clone_name, as before, gives a dir pool's name its
suffix, and the template copy and the storage clone job use it. Metadata
preallocation is asked only for qcow2, the one format libvirt
preallocates. A raw file copy no longer gets qcow2's compat options, and
an RBD copy no longer passes the preallocation flag, which the RBD
backend refuses.
2026-11-14 19:43:11 +03:00
catborise
4aa78b6f1c fix(vrtManager): a copy into an LVM or RBD pool is raw and allocated whole
A new VM from a qcow2 template in an LVM pool failed: the copy asked for
qcow2 with qcow2's options, which libvirt refuses there ("compatibility
option only available with qcow2"). Made raw, it still failed: with no
allocation an LVM volume is a sparse snapshot, which qemu-img's copy
filled and the kernel invalidated (I/O error). A copy into a pool of no
files is now raw, as big as its source and allocated whole, as a new
empty volume there already is. Checked live: a qcow2 template copied
into an LVM pool.
2026-11-14 15:28:56 +03:00
catborise
dd258888d2 refactor(vrtManager): a new VM's copy of a template is made by clone_volume
clone_from_template wrote its own copy XML next to wvmStorage.clone_volume,
which the volume and VM clones use. clone_volume now takes the volume to
copy, of its pool or another, so the template's copy goes through it too;
it leaves metadata unallocated in a pool of no files, as the template copy
did. A qcow2 template's copy in a file pool is now named <vm>.qcow2, like
a new empty disk, not <vm>.img.
2026-11-14 15:23:26 +03:00
catborise
0d68888510 test(instances): live disk and NIC posts send what their forms send
Since ad9c3ad9 a disk's detach and delete forms post the disk's path, and
since b664e341 a NIC's form posts net-seen, its saved definition as the
page read it; a post without them is refused as made from a stale page.
Four live tests still posted the old fields, were refused and failed;
test_clone then failed too, on the extra disk the refused delete left.
They now post the same values as the forms.
2026-11-14 14:38:25 +03:00
catborise
ee662618b2 refactor(instances): the VM page and new VM steps name what their templates get
The VM page and the two new VM steps rendered locals(): every local of
the view reached the template, so which values a page uses could not be
read from the view, and a renamed variable left part of a page blank
without an error. Each view now passes a dict of the names its template
reads. The assignments that only existed for locals() (conn = None,
empty storage and network lists, meta_prealloc, unused defaults) are
gone. A new VM step whose host could not be read shows what it showed
before.
2026-11-14 14:14:23 +03:00
catborise
d68e22878a refactor(storages): the storage pages name what their templates get
The pool list and pool pages rendered locals(); they now pass a dict of
the names their templates read. A list whose host could not be read
keeps the new pool dialog, as before.
2026-11-14 13:36:06 +03:00
catborise
c64dd8fb3c refactor(networks): the network pages name what their templates get
The network list and network pages rendered locals(); they now pass a
dict of the names their templates read. A list whose host could not be
read keeps the new network dialog, as before.
2026-11-14 13:36:06 +03:00
catborise
e4c8e4e0eb refactor(interfaces): the interface pages name what their templates get
The interface list and interface pages rendered locals(); they now pass
a dict of the names their templates read. A page whose host could not be
read shows the host only, as before.
2026-11-14 13:36:06 +03:00
catborise
3c9b34ae48 refactor(datasource): user data names what its template gets
The cloud-init user data rendered locals(); it now passes the one value
its template reads, the VM's keys, as the job that writes a seed does.
2026-11-14 13:36:06 +03:00
catborise
3dbd4c0316 refactor(nwfilters): the filter page names what its template gets
The filter page rendered locals(): every local of the view reached the
template, so which values the page uses could not be read from the view,
and a renamed variable left the page blank without an error. The view
now passes a dict of the names the template reads; a filter that could
not be read shows the host only, as before.
2026-11-14 13:36:06 +03:00
catborise
d6df6b1df4 fix(instances): console changes that cannot be made are refused, not reported as done
A switch to the serial console removed the graphics device but kept a
serial console of another type, a TCP one say, which the browser does
not open; the audit log said the console type was set. The switch is now
refused, with nothing changed, unless the serial console is a pty one.

A listen address change of a console that listens on a network, a socket
or nowhere did nothing without a word. It is refused with the reason.

The .vv file pointed virt-viewer at "::" for a console on all IPv6
addresses; such a console is reached through the host, as one on
0.0.0.0.
2026-11-13 22:49:28 +03:00
catborise
88e7e0fa90 fix(instances): a console settings page opened before another change does not undo it
The console form compared what was posted with the settings saved at the
time of the save, so every field of a page opened earlier counted as a
change: an administrator who moved a console to localhost had it opened
to all interfaces again when another one, on an older page, only
generated a new password. The form now sends back a fingerprint of the
type, listen address and keymap it showed, and a save made after these
changed is refused with a message to check them and save again.

A refused save names the reasons without the field names.
2026-11-13 22:49:23 +03:00
catborise
7fe79463fc fix(instances): saving a SPICE console's settings keeps it SPICE
The console type list offers VNC and Serial only, so the page of a SPICE
VM showed VNC and any save, of the keymap alone, switched the console:
libvirt refused the definition when the VM had a SPICE channel, and
without one the VM silently got a new VNC console. A console type the
panel does not create is now offered as it is, and kept on save.

A switch from SPICE that is chosen removes the SPICE channels, USB
redirection and smartcards libvirt refuses without SPICE graphics and
mutes SPICE audio. A new VNC console keeps the keymap and a password VNC
can take; a longer one is replaced by a generated password.

The console settings were read from the first graphics device that had
each attribute: with VNC and SPICE devices the page showed VNC's port
with SPICE's password. All are read from the first device, the one the
settings change.
2026-11-13 22:49:21 +03:00
catborise
cd3edf4dff fix(instances): a VNC password the browser console can send, kept as set
The console settings accepted any password of at most 8 bytes, so "éééé"
was saved, but noVNC derives its key from the characters while QEMU
compares the UTF-8 bytes: the browser console could not log in. A new
password now takes up to 8 printable ASCII characters, which also keeps
control characters out of the definition.

The .vv file wrote the password and the VM name as they are; virt-viewer
reads it as a GLib key file, so a backslash or a leading space changed
the password. Both are escaped as a key file expects.

A new or removed password also drops a passwdValidTo set elsewhere: an
expired one left the new password unusable.
2026-11-13 22:49:12 +03:00
catborise
275bf11aed fix(computes): a chart places each reading at the time it came
The CPU, memory, disk and network charts of a host and of a VM put their
readings at equal steps: a reading that took 20 s looked like one 5 s
after the one before. The x axis now counts seconds, a reading standing
at the time it came; each tick is at a reading and named with the
panel's time of it, as before. Checked with Chart.js in a browser: a
20 s step is four times as wide as a 5 s one.
2026-11-13 16:38:42 +03:00