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

470 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
be4616ee85 fix(computes): a VM that cannot be read leaves a host's capacity unknown
A host's capacity sums its VMs' vCPUs and memory; a VM busy with a job
is read from its XML. A VM whose XML could not be read for any reason
was skipped as if gone, so a refused read or a dropped connection made
the host look as if it had given less than it had, even nothing. Only a
VM gone meanwhile is skipped now; another error leaves the capacity
unknown, which the pages show as not read.
2026-11-13 16:38:42 +03:00
catborise
81d183f802 fix(computes): a host's CPU chart counts I/O wait as idle, and its memory in GiB
The CPU in use was the share of time not idle, with I/O wait counted as
busy: a host that only waited for its disks showed 100% CPU in use. Time
waiting for I/O is idle now: no CPU runs then.

The memory chart divided by 1024³ and labelled the values GB; it says
GiB now.
2026-11-13 16:38:42 +03:00
catborise
cf1f7ad055 fix(instances): a host that does not answer no longer holds the VM lists
The VM list and its poll read each host in turn. A host that is up but
stuck (a daemon or an NFS mount that does not answer) kept the call
waiting: the list did not open in 200 s (seen live with compute1's
virtqemud stopped), and the per-host limit freed it only when gunicorn
ended the request after 600 s. The list and the poll now ask all hosts
at once, each in a thread counted on its host like a request, and wait
10 s at most: a host that has not answered is shown as not answering,
and the VMs of the others are listed. Live: the list opens in 10 s,
then in 5 s while the host stays stuck.
2026-11-13 16:07:01 +03:00
catborise
7bbc951082 fix(instances): a clone's NIC filter keeps no address of its source's
A NIC filter such as clean-traffic can name the VM's own MAC and IP as
parameters. A clone kept the source's, so the filter dropped the clone's
traffic from its new MAC. A clone's MAC parameter is now its own MAC,
and its IP parameter is left out for the filter to learn the clone's
address, as clean-traffic does by default; with learning turned off
(CTRL_IP_LEARNING none) the filter needs it, and it stays, as an IPV6
parameter does (libvirt learns no IPv6 address).

A filter page showed the actions drop, reject, return and continue in
English in every language; they are translated now.
2026-11-13 11:46:12 +03:00
catborise
b1c6184931 fix(instances): a VM is not migrated to a host whose filters of its names differ
A migration checked only that the destination had network filters of
the names the VM's NICs use. A VM runs with its host's filter of a name,
whatever its rules: a destination whose filter of that name was empty,
or lacked a filter it references, left the VM unfiltered there. The
filters the VM names and those they reference are now compared rule by
rule (each host's UUID aside), and one missing or different on the
destination refuses the migration.

A filter created or edited with a reference to a filter the host does
not have, which libvirt accepts, is refused too: a VM using it would not
start.
2026-11-13 11:46:01 +03:00
catborise
b664e34161 fix(nwfilters): two changes at once do not undo each other
A rule or reference change reads a filter and defines it again whole:
two admins changing one filter at once each defined their copy, and the
second removed the first's rule. Changes to a host's filters (create,
clone, delete, rules, references, XML) now run one at a time; one that
finds another running is told to try again.

A VM's NIC form sends back its source, model, filter and MAC whole: a
form opened before another admin changed the NIC's filter put the old
filter back. The form now sends a fingerprint of the NIC as it showed
it, and a NIC changed meanwhile is refused.
2026-11-13 11:46:01 +03:00
catborise
2f7516b7f9 fix(nwfilters): a filter is checked against libvirt's schema before it is defined
libvirt drops the attributes and elements of a filter it does not know,
without an error. A rule accepting <tcp dstport='443'/> (dstportstart is
the attribute) became a rule accepting all TCP; a rule dropping
<tpc dstportstart='22'/> became one dropping all incoming traffic; a
priority of 5000 became 500 (all seen live). Creating, cloning and
editing a filter and adding or removing its rules and references now
define it with VIR_NWFILTER_DEFINE_VALIDATE, and libvirt's refusal names
what it did not accept.
2026-11-13 11:20:47 +03:00
catborise
143a74b145 fix(storages): a volume another compute's VM uses on shared storage is not deleted
A pool on shared storage (an NFS share, or a directory mounted from one)
holds the same file at the same path on every host that mounts it. A
VM's delete checks the panel's other computes before it deletes its disk
files, but the pool page, its API and a VM's disk delete checked only
their own host: a disk of a VM on another compute could be deleted. They
now ask the other computes too, and refuse while one uses the file or
cannot be reached. The other computes are asked before this host's lock
is taken, and before a VM's disk is detached.
2026-11-13 10:41:18 +03:00
catborise
fb3b2f479e fix(storages): a share or LVM pool a VM's disk path is in is not deleted
Deleting a pool was refused only while a VM's definition named the pool
for a disk; a disk given by its file path was taken not to need it. That
holds for a directory pool, but a share's or a file system's pool mounts
the path and an LVM pool activates it: with the pool deleted, the path is
gone at the next boot and the VM no longer starts (seen live with an NFS
pool). Such a disk now refuses the delete too: a path under the pool's
mount point, or an LVM volume by its /dev/<group> or /dev/mapper name.
iSCSI and disk pools share their device directories with other pools and
are left as they were.

A pool libvirt reports as inaccessible (state 4: running, its storage out
of reach) made the pool page fail with an IndexError; it now shows an
Inaccessible badge.
2026-11-13 10:41:03 +03:00
catborise
272a40f4e1 fix(instances): power off does not wait a minute for a guest agent that hangs
libvirt shuts a VM down through its guest agent when one is connected,
and waits 60 s for an agent that hangs before it presses the ACPI power
button. The Power Off request hung for that minute, holding the VM's
lock. A running VM's connected agent is now pinged first; one that does
not answer in 10 s is passed over and the power button is pressed.
2026-11-13 08:44:03 +03:00
catborise
3412c63417 fix(instances): a Windows VM's root password and SSH key are refused in words
On a running Windows VM with its guest agent connected, the Access tab's
root password and SSH key were sent to the agent, which has no root
account, takes no crypt(3) hash and has no SSH key command: the owner got
the agent's raw error. The guest's OS is now asked first, and a Windows
guest is refused with a message.
2026-11-13 08:43:50 +03:00
catborise
6b92e24359 fix(interfaces): the interface the panel reaches its host by is kept
An interface carrying the address the panel reaches the host by, or a
device in it, could be stopped, and a bridge could be built over such a
device without that address; either cut the panel off the host, with
only a confirmation dialog in the way. Both are refused now: a bridge
over such a device must take the address, or DHCP of its family. The
addresses are the ones libvirt reports for the running interface; one
whose addresses netcf cannot report (a virtio card) and that leases
them is kept too.

A bridge dropped its device's MTU, so jumbo frames stopped; the bridge
now takes it (netcf gives the bridge's MTU to its members), and a
deleted bridge gives it back to its members.
2026-11-12 16:17:33 +03:00
catborise
de249ebad7 fix(interfaces): an interface a VM or a network uses is not deleted
A stopped bridge was deleted while a shut-off VM's network card or a
libvirt network named it; that VM or network then did not start.
Deleting an interface is now refused while any definition of a VM,
running or not, or a network names it, with their names.

A new bridge was offered a device a VM's macvtap card or a network
forwarding to it used; bridging it cut that VM off. Such devices are no
longer offered. A NAT or routed network's outgoing device counts as
used too.
2026-11-12 16:17:33 +03:00
catborise
edc165cfc4 fix(instances): a VM is not migrated to a host without its secrets
A shut-off VM whose disk, host device or vTPM names a secret was moved
to a host that does not have that secret: libvirt defines the VM there,
the source definition was removed, and the VM then did not start. A
migration now names the secrets the destination lacks, by UUID or by
usage, and is refused before anything changes, as it is for networks.
2026-11-12 16:17:21 +03:00
catborise
b7724928fd fix(virtsecrets): a secret in use is not deleted by its UUID in capitals
libvirt finds a secret by its UUID in capitals too, but its users were
looked up by the UUID as posted: a secret a VM's disk or a pool named
was deleted, and that VM or pool no longer started. They are now looked
up by the secret's own UUID.

A usage with a control character made the page fail (lxml refuses it in
XML text) and libvirt dropped a line break silently; the form refuses
both. An empty value set later showed libvirt's "value in
virSecretSetValue must not be NULL"; it is refused in words.
2026-11-12 16:17:21 +03:00
catborise
159049736d fix(instances): a VM of an architecture without firmware choices or PCI cards can be created
The create page shows no firmware choice for an architecture whose host
offers none, yet the form required one, so such a VM could never be
created from the page. The firmware is now optional there: the machine's
own is used, as the job and the API already did.

s390x machines have no PCI bus for the emulated network cards (e1000,
e1000e, rtl8139), yet the create page and the VM's network tab offered
them for every architecture. They now offer default and virtio there,
and a create job refuses a card model the VM's architecture cannot have.
2026-11-12 15:21:48 +03:00
catborise
d00f7d8841 fix(networks): the XML editor does not overwrite a change made meanwhile
The network and filter XML editors defined what they sent as a whole, so
a page opened before another admin's change (a QoS limit, a filter rule)
saved over it and the change was gone without a word. The editor now
sends a digest of the definition it showed, and a definition changed
since is refused with a reload hint.
2026-11-12 13:30:09 +03:00
catborise
534782fdda fix(networks): a network or interface in use is not stopped, and a new one is whole
An interface was stopped from the Interfaces page while running VMs had
cards on it, directly or through a network using it, and they were cut
off; a network in the same case was already refused. Stopping it is now
refused the same way, naming the VMs.

A new network whose autostart could not be set stayed defined and
running while the page said it failed; it is now stopped and undefined
like one that does not start, and a rollback that fails is said with the
first error. A network named "." or ".." is refused: its page address
was another page.

A VM create checks when it is asked and again when its job starts that
the host has the networks and the filter it names, and that no card is
left without a network: one deleted meanwhile, or an empty name in the
list, left a VM that does not start once its disks were made.
2026-11-12 13:30:09 +03:00
catborise
3308a75557 fix(instances): a VM's network cards name networks and filters its host has
libvirt saves a network card whose network or filter the host does not
have, and the VM then does not start: a card added or changed with an
unknown network (net:missing) or filter was saved and the page said the
card was changed. Adding or changing a card now refuses a network or
filter the host does not have; a stopped network is still the host's.

A migration defines the VM on the destination the same way: a shut-off
VM moved to a host without one of its networks or filters stayed there
unable to start. The migration now refuses such a destination before
anything changes.
2026-11-12 13:25:30 +03:00
catborise
a78d92e7aa fix(networks): a fixed address has a host name, a host address and is changed as shown
dnsmasq skips a fixed address whose name is not a host name ("bad DHCP
host name"): the VM got no fixed address while the page said it was set.
A name now has only letters, digits, '.', '_' and '-', as the dialog
already asks.

An IPv4 fixed address or DHCP range end may no longer be the subnet's
network or broadcast address.

The edit dialog sends the entry's MAC or DUID and name as the page showed
them; an entry another admin changed meanwhile is refused instead of being
changed back.
2026-11-12 13:25:30 +03:00
catborise
d682c4bc82 fix(computes): a changed compute does not use or list its old host
A compute saved with another address, login or password, or deleted, left
its connection open in the panel: saved back to the old credentials, the
panel used it again although the host no longer took them. A VM list that
read the host before such a change could then save that listing over the
VMs of the new one.

The old connection is retired when a compute's connection changes or the
compute is deleted, and a listing is saved only when the compute's
connection is still the one it was read with.
2026-11-12 09:19:03 +03:00
catborise
2db25314ea fix(instances): USB device changes as PCI ones; device refusals name no VM to owners
- A USB device added to or removed from a VM with a saved state applied
  only at the next cold boot: refused now, as for PCI devices, and the
  form says so.
- A USB hot plug or removal that failed half way said only libvirt's
  error: it now says where the device is, as for PCI devices
  (_hostdev_outcome, shared).
- A host device refusal (check_hostdevs) names the other VMs that have
  the device; users who do not see the hosts, such as an owner whose
  snapshot revert is refused, now read that a device is not free and that
  an administrator can see why.
- The host's USB devices named among a PCI device's host resources were
  English in every language.
2026-11-11 22:58:40 +03:00
catborise
d07362106a fix(instances): the XML editor and a VM defined from XML check its host devices
The Host devices tab checks a device before it gives it: no other VM has
it, the host does not use it, its IOMMU group can go along. The XML editor
and the define-from-XML form saved any <hostdev> unchecked. Both now run
the same check (check_hostdevs) on the definition saved, the editor when
the XML gives or changes host devices, so an edit of a VM whose device the
host lost since is not stopped. The editor holds the whole compute, as
the tab does, so two edits cannot give one device to two VMs.
2026-11-11 22:58:34 +03:00
catborise
a36ffcd3ba fix(instances): a VM starts only with host devices the host can give now
A device is checked when it is given to a VM, but a start later did not
check it again: a PCI device bound back to a host driver for the host's
own network or disks, or a USB device the host no longer has as named,
was taken from the host or failed in libvirt. Power On and Power Cycle now
check the definition the VM starts from (its saved state's when restored)
as a snapshot revert does, and refuse with the reasons; Power Cycle checks
before it stops the VM.
2026-11-11 22:58:34 +03:00
catborise
4045819b8d fix(instances): the Host devices tab says when the host cannot give a VM's USB device
libvirt does not start a VM whose USB device the host does not have as the
definition names it: a device replugged gets another address, and a second
device of a model makes a model-only name ambiguous. The tab said nothing
and the start failed with libvirt's words. The tab's form now says which
device the next start cannot have and what to do (usb_unmatched), and a
snapshot revert checks the same before it starts (check_hostdevs). The
add form posts the device's IDs with its address: a device replugged since
the page was loaded is not given in its place.
2026-11-11 22:58:34 +03:00
catborise
f0a9d2cf82 fix(vrtManager): a disk in an inactive pool keeps the files it may be made from
Only a running disk's definition has its backing chain; for the others the
in-use check reads it from the volumes of active pools. With such a disk's
overlay in an inactive pool (a stopped VM's, the next start's, a saved
state's or a snapshot's), its backing file counted as unused, so deleting
another VM with its disks, or the volume itself, could delete it. The check
now refuses (InUse) while a disk that is not running and not raw has its
file in an inactive pool, and says to start the pool. A snapshot delete
that is done reports no left-behind files then, rather than failing.
2026-11-11 15:21:49 +03:00
catborise
1957a5a85a fix(instances): memory, boot order and QoS edits check what they change first
Three edits went wrong on input or a state made outside the panel:

- A running VM's memory was set live, then for its next start. When the
  next start had a lower maximum (virsh --config), the live change was
  made and the second one failed. The maximum of the next start is now
  checked first.
- A boot order entry without its device type ("disk") raised an error
  page. It is now refused with a message.
- A QoS form of a NIC whose MAC changed since redefined the VM unchanged
  and said the QoS was set or deleted. It now says the NIC is not in the
  definition.

Turkish and Chinese texts included.
2026-11-11 12:55:34 +03:00
catborise
fce63996ba fix(instances): a refused vCPU resize keeps the VM's vCPU hotplug
With vCPU hotplug on, a resize defined the VM three times: without its
hotplug settings, with the new counts, with hotplug settings again. When
libvirt refused the new counts (a maximum over the machine type's limit),
the VM was left with hotplug switched off and an error.

The counts and the hotplug settings for them now go in one definition.
2026-11-11 12:55:34 +03:00
catborise
897c95a5bf fix(instances): a VM's saved state keeps the disks it starts with
A VM with a saved state (managed save, as libvirt-guests leaves VMs when
its host shuts down) shows as shut off, and its start restores the
definition it was saved with. The panel let the VM's Delete remove a disk
of it, and the storage pool delete a volume detached since: the VM then
did not start ("Cannot access storage file"), and the panel has no way to
drop the saved state.

A VM's Delete now refuses a disk while the VM has a saved state, and a
volume in a domain's saved state is in use for every delete check.
2026-11-11 12:55:34 +03:00
catborise
dabb7f4678 fix: worker warnings and CPU windows do not depend on a wall clock
The job panel warned "Worker unavailable" when the worker's last
heartbeat was more than 60 s older than the browser's clock: a browser
set two minutes ahead warned about a worker that had just beaten, and
one behind hid a worker that had stopped. The server now says whether
the worker is gone (worker_gone in the job panel's answer), by the same
rule as the Jobs page.

A host's CPU graph measured its averaging window with time.time(): a
clock set back between two polls gave a negative window. It now uses
time.monotonic(), as a VM's usage already does; a sample from before
the server restarted is measured over a second again.
2026-11-10 12:21:36 +03:00