1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-11 12:46:49 +00:00
Commit graph

815 commits

Author SHA1 Message Date
catborise
b95f2a28d7 fix(instances): the VM page's DRBD state does not rewrite the VM's record
With VM DRBD Status on, the VM page saved the whole record it had read
after waiting up to its ssh timeout for the host. A migration or delete
that finished meanwhile was undone: the record moved back to the old
compute, or came back without its owners. Only the DRBD state is written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-10 13:19:39 +03:00
catborise
373760f2c5 fix(instances): a VM name of any length libvirt takes is kept
libvirt names a VM by its <name>.xml file, so a name can have up to 251
bytes. The panel's VM, removed-VM and log records held 120 characters:
on PostgreSQL one longer name made the host's sync fail and the VM list
answer with an error. They now hold 255.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-10 13:11:22 +03:00
catborise
0d20d07b29 fix(ui): host and VM charts give their points the panel's time
A host's charts and their "Updated at" line took their times from
timezone.now(), which is UTC, while a VM's charts took time.strftime(),
the panel's time zone. With TIME_ZONE=Europe/Istanbul the same moment
read 09:00 on the host page and 12:00 on the VM page. Both now give the
panel's time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-10 11:57:43 +03:00
catborise
a8f7c8aeaa fix(logs): the VM page's Logs tab shows times as the Logs page does
The Logs tab of a VM's Stats showed each row's time in UTC, formatted by
the process locale ("11/10/26 08:43:08" whatever the page's language),
while the Logs page shows the same row in the panel's time zone
("2026-11-10 11:43:08" with TIME_ZONE=Europe/Istanbul). The tab now
shows the panel's time in the Logs page's format, and its Date heading
names the zone as the Logs page's does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-10 11:52:54 +03:00
catborise
139e43e4c4 fix(instances): the VM page says when its host stops answering
The VM page polls the VM's state every 5 s and reloads when it changes.
When the host stopped answering, the poll failed and nothing changed on
the page: it kept showing the last state, figures and actions as if they
were current. A notice now says that the page could not be refreshed and
may be out of date while the poll fails (a host that does not answer, a
session that ended); it goes away with the next answer. Checked on
compute1 in headless Chromium with its libvirt port dropped and restored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-10 11:12:21 +03:00
catborise
6cdda6d4f3 fix(instances): the VM list survives a host that stops answering mid-request
The VM list reads each reachable host's CPUs and memory while it renders,
after it has found the host reachable. When the network to a host
dropped during that request, libvirt's keepalive closed the connection
in between, and the read raised: the whole list became the 500 error
page after about 40 s. Only the next load showed the host as down.

The host's CPU, memory and memory-use reads now give None for a host
that stopped answering; the list leaves its numbers out and the New VM
dialog does not offer it. Checked on compute1 with its libvirt port
dropped mid-request: the list answers 200.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-10 11:12:08 +03:00
catborise
aefe551450 feat(ui): the owner and VM lists of the ownership forms are searchable
The VM page's Add owner and a user's Add VM page listed every user and
every VM in a plain drop-down: with 800 users and 300 VMs one was found
by scrolling. They now have a search box (Tom Select, already used by the
create form), through searchable_select.js for a select with
data-searchable.

The box loses focus once an item is chosen: focused, it is a line taller,
and on a phone the tap on Save shrank it and moved the button away from
under the finger, so the first tap did nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-10 09:21:25 +03:00
catborise
b91a9d6f28 fix(instances): a long VM name wraps on its page
The VM page's heading did not wrap a name without spaces: a 185-character
name made the page 2,600 px wide, even on a 1440 px screen, and pushed the
state badge off it. The heading now breaks the name and the badges wrap
below it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-10 09:04:19 +03:00
catborise
e6155c855a fix(instances): a late cancel leaves a later job's migration or disk move alone
A cancel that comes before libvirt began a migration or disk move waits
for it. When the job ended meanwhile and another job of the VM started
its own migration or copy within the hook's second of sleep, the hook
took that for its own and aborted it. The hook now asks whether its job
is still active right before it aborts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-09 16:34:20 +03:00
catborise
8197e645f9 fix(instances): a VM delete waits at most 60 s for another host's disk check
Deleting a VM with its disks first asks the other computes whether they
use its files. A host that is connected but does not answer (a hung NFS
mount under a pool) held the delete job for good, and with it a slot of
the worker: a few such deletes could fill the pool and stop the jobs of
healthy hosts. The check now waits USED_CHECK_WAIT, as the disk move and
migration checks do; a host that does not answer in time stops the
delete before anything changes, naming the host. Until it answers the
earlier check, a retried delete is refused at once instead of asking it
again, so the calls waiting on it do not pile up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-09 16:34:06 +03:00
catborise
f6c7f8c85e fix(i18n): chart series and the preset announcement in the page's language
The VM and host charts named their series in English (Usage, Usage (RSS),
Read, Write, Inbound, Outbound) and the new-VM form announced an applied
preset as "...new N GiB disk" in English on Turkish and Chinese pages.
The texts now come from the templates: the stats tab and host overview
give the series names (disk and NIC series reuse In, Out, Read, Write of
the readings line), and each preset button carries its own announcement.
"Usage" has the context "chart": zh translated it for secrets as "used by".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-09 14:41:48 +03:00
catborise
f18287d3b8 fix(instances): the delete page names the host only where hosts are shown
The confirmation page put "on <host>" in its heading for every owner who
may delete the VM, while the VM list and page show the host only to
superusers and users with view_instances.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-09 13:54:28 +03:00
catborise
0cee65805d fix(instances): a template's console settings cannot be changed by a POST
A template's page has no console settings form (it is cloned, not run),
but update_console still took a direct POST from a staff owner with
is_change and is_vnc, or from a superuser. can_manage_console now refuses
every template, so the page and the view use one rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-09 13:53:51 +03:00
catborise
9f323d709e test: no test connects to a real host
Tests of eight files patched a host's status but not what the page also read, its
connection, connection_error or proxy, and so connected for real: over
ssh to 10.0.0.9 or over TCP to unroutable addresses (5 to 10 s each until
the connect timeout), and to the machine's own libvirt (qemu:///system).
A failed host is not tried again for a while, so only the first such test
of a process connected, and which one depended on the order. They now
patch the connection itself, or what the page reads, and use RFC 5737
addresses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-08 22:22:16 +03:00
catborise
6dab3b210c test(migrate): the worker refuses a migration whose user may no longer migrate
The worker checks again, before it migrates, that the job's user is
still an active superuser; no test removed either while the job was
queued, so the check could go unnoticed, as it is tested for clones and
new VMs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-08 21:20:06 +03:00
catborise
2ee3e5ddad test(quota): the concurrent resize test checks what happened to each request
The test asserted only that one resize ran: a request that failed for any
other reason in its thread, unseen, passed it as well. It now collects
each request's messages, or its exception, and asserts that one resized
and the other was refused by the user's quota lock or by the quota.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-08 21:20:06 +03:00
catborise
0ac078b9cc fix(vrtManager): an RBD disk takes its pool's auth and monitors as they are
A disk of an RBD pool, at VM creation or added later, had the pool's
user, secret uuid and monitors put into its XML as strings: a user with
a quote or ampersand broke the XML, and a secret named by usage gave
IndexError on attach and uuid='None' at creation. One function now
copies the pool's auth (uuid or usage) and host elements into the
disk's source with lxml, replacing the two string builders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-08 14:42:20 +03:00
catborise
ff46ae509f fix(vrtManager): a template's copy takes qcow2's options only as qcow2
The copy of a template for a new VM always got qcow2's compat and
lazy_refcounts, which libvirt refuses for a qcow template, and only a
dir pool named it as a file. Every pool of files now does, and only a
qcow2 copy gets those options. The pool types of files are one list,
which the cloud-init seed check also reads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-08 14:35:19 +03:00
catborise
f952d4e0d0 fix(vrtManager): a VM's new disk in an NFS or filesystem pool keeps its format
A new VM's disk and a disk added to a VM were built by a copy of the
volume XML of the Storage page that kept the format in dir pools only:
in an fs or netfs pool a qcow2 disk became a raw one allocated whole,
and a qcow disk got qcow2's compat and lazy_refcounts, which libvirt
refuses. Both now use the Storage page's builder, where every pool of
files keeps the format and the other pools make a raw volume without
metadata preallocation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-08 14:34:51 +03:00
catborise
8f09812b7d fix(instances): a new VM's existing volume or template is taken from the chosen pool
The create job looked volumes up by name in every active pool and took
the first match, so a volume of the same name in another pool could be
attached or copied in place of the chosen one. The form now sends each
existing volume as pool/volume and the template's pool, and the job
looks each up in its own pool.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-08 14:33:10 +03:00
catborise
d2383be914 refactor(vrtManager): new VM UUIDs come from uuid.uuid4()
randomUUID() built a version 4 UUID from 16 random bytes by hand; the clone and create jobs now take str(uuid4()) from the standard library, and the function and its format test go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-08 12:24:47 +03:00
catborise
f97708a7b7 refactor(instances): a new disk's name prefix comes from vol_dev_type
get_new_disk_dev() mapped virtio to vd, ide to hd, fdc to fd and other buses to sd itself; vrtManager.util.vol_dev_type() has that mapping, and the bus change in vrtManager uses it with the same sd fallback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-08 12:24:18 +03:00
catborise
cc104716e0 refactor(instances): a migration merges owners with move_ownership
record_migration() repeated computes.utils._move_ownership() line by line: owners move to the record the destination already has, a user's rights are merged and the template mark is kept. It now calls that function, renamed move_ownership as it is used from both apps; the owners left on the source record go with it, by cascade.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-08 12:20:17 +03:00
catborise
9ec3c09358 refactor(vrtManager): remove the wvmConnect.close() that did nothing
Its body was a pass: connections are kept by the connection manager, not closed per object. The calls to it, and the finally blocks and None guards that only called it, are removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-08 12:19:29 +03:00
catborise
1289478f79 chore: remove commented-out code
Old redirects, sample return values and test fragments that were commented out and never came back: storages/views.py, vrtManager/connection.py and instances/tests/test_live_views.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-08 12:16:44 +03:00
catborise
496d3a48ad refactor(instances): the VM list calls refresh_instance_database itself
instances.utils.refr() only imported and called computes.utils.refresh_instance_database(); the views import it directly, as they import its siblings from computes.utils.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-08 12:15:33 +03:00
catborise
e554390ddf refactor(instances): the VM and new VM pages build only what their templates read
Both views render locals(), and kept settings no template reads: keymaps, the console listener addresses and the disk io, discard and detect-zeroes defaults on the VM page; the AppSettings rows, an empty hypervisor list and seven disk defaults on the new VM page, the create job reads its own. Commented-out assignments next to them go too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-08 12:09:23 +03:00
catborise
6f12e10091 perf(instances): the new VM page does not list the host's VMs or read its capabilities
The page never showed either: get_instances() looked up every running domain and get_capabilities() parsed the host capabilities on each load, and both results were thrown away.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-08 12:02:18 +03:00
catborise
ce98bc85d0 fix(instances): recovery removes the UEFI variables copy of a clone that was not defined
A shut-off clone copies the VM's NVRAM file just before it defines the
clone; a worker that stopped between the two left the copy, unnamed by
the job, which recovery then reported as leaving nothing. The job
records the copy's path once libvirt made it, and recovery deletes that
file when the clone was not defined, in whichever pool it is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-07 23:58:50 +03:00
catborise
d49db11e78 fix(instances): a clone's MAC address is not the VM's or another of its NICs'
The addresses were checked for their form only: a clone could keep the
VM's address, or give two NICs one, and the NICs on a network then take
each other's traffic. Such an address is refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-07 23:56:04 +03:00
catborise
41ef48f2e0 fix(instances): a clone's name is at most 64 characters, as a new VM's
The name's length was not checked: libvirt defined a clone of a name
longer than the panel's records hold (120), and the job failed to record
it, leaving a VM the panel did not list. The form and the job take 64,
as for a new VM.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-07 23:56:04 +03:00
catborise
4ee88d6767 fix(instances): a shut-off clone into a volume name its pool has is refused before it begins
libvirt refused the copy only after the job had begun; recovery then
found a volume of the planned name and ended the job uncertain, holding
the VM. The names are checked when the job is queued and before it runs,
as a live clone did; that check now refreshes the pool first, so a live
clone's free space is read current too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-07 23:56:04 +03:00
catborise
aadf5270f2 fix(migrate): recovery removes the disk copies of a migration whose worker stopped
A worker that stopped during the copy left the partial files on the
destination: libvirt ends the migration and the VM stays, but the files
took the space and refused the next try, as a copy never replaces a
file. The job records the copies before libvirt makes them, and
recovery deletes them while the destination has no VM of it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-07 23:10:19 +03:00
catborise
d2a637cf33 fix(migrate): recovery ends a cancelled migration by where the VM is
A libvirt error after a cancel ended the job cancelled at once; a
migration that finished but lost its last reply left the VM on the
destination and its record on the source. The error goes to recovery,
which ends the job cancelled when the VM stayed and succeeded when it
moved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-07 23:10:19 +03:00
catborise
826eaac813 fix(migrate): a copied disk's source file is deleted only when no compute may use it
The source host alone was asked: a file on storage the computes share,
used by a VM or volume of another compute, was deleted under it. The
check the disk move makes, every compute and a host that cannot tell
counting as using it, moves to instances.utils and serves both. The
destination is not asked when its copy has the source's path: its VM
uses that copy, another file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-07 22:51:25 +03:00
catborise
f411659f40 fix(deps): libpass instead of crypt-r; gstfsd's python3-libguestfs on a RHEL compute; PyYAML for the tests
- The root password's SHA-512 crypt hash comes from libpass (the maintained
  passlib fork, pure Python) instead of crypt-r, a copy of the stdlib crypt
  module gone in Python 3.13: crypt-r ships no wheels and its build needs
  crypt.h, which Ubuntu 26.04 no longer brings with python3-dev, so the
  installer and the manual installation failed there. The hash is the same
  format ($6$, now with libpass's 656000 rounds), checked with glibc's crypt.
- The README's RHEL compute packages left out python3-libguestfs, which
  gstfsd imports with the system python: setting the password or key of a
  shut-off VM failed there.
- The tests read YAML themselves and had PyYAML only through
  drf-spectacular.
2026-11-07 17:52:35 +03:00
catborise
129327358d fix(instances): an empty panel says what to do next
- The VM list with no VMs no longer also says that no VM matches the
  search and the state.
- The New VM dialog with no compute yet says to add the first host, with a
  link to the Computes page (and links there when none is reachable).
- The new VM page on a host without a running storage pool or a network
  says what to add or start and where, instead of "You haven't defined any
  storage pools" (also when pools exist but are stopped) and "network
  pools".
2026-11-07 16:50:24 +03:00
catborise
0b4a601ecb fix(quota): a disk whose size is unknown is not counted as 0 GiB
A disk of the user's VMs whose size could not be read (its volume not in a
pool, the pool stopped) counted as 0 GiB, so a disk-limited user's increase
could pass over the limit. A disk no pool holds now has the size libvirt
reads from the file or device (blockInfo, also for a shut-off VM); one whose
size is still unknown makes the usage unverified and the increase is
refused, as when a host cannot be reached. Users without a disk limit are
not affected.
2026-11-07 16:19:12 +03:00
catborise
d8a184eff7 fix(quota): a snapshot revert must fit the quota
A revert gives the VM the vCPUs and memory it had when the snapshot was
taken. An owner could take a snapshot, shrink the VM, give the freed share
to another VM and revert, ending over the quota. The revert now checks
what it adds to the VM (against the larger of its running and next-start
sizes) as a resize does: on the page when it is queued, and again in the
worker before it runs, as a resize may have used the quota meanwhile.
2026-11-07 16:19:03 +03:00
catborise
aab8dbf1df perf(instances): a VM page does not wait for the guest agent's addresses
A running VM's page read its addresses while it rendered: the guest agent,
when its channel is connected but it does not answer, holds the page (and
a gunicorn worker) for its whole 10 s timeout, on every load. The page now
shows them once it has loaded: vm_addresses.js asks the new
instances/<pk>/addresses/ for each NIC's addresses and fills the header's
IPv4 and each network card's IPv4 and IPv6.
2026-11-07 15:42:49 +03:00
catborise
c5c6de6ba8 fix(logs): a job's rows carry the address it was asked from, and a cancel its own user
A job keeps the client address of its submission (Operation.client_ip,
migration operations.0003); the rows the worker writes for it, including the
migration's and the VM delete's own rows, carry it. A cancel is written under
the user who asked and from their address, also when an administrator
cancels another user's job; a running job's cancel gets a row when asked,
and its end a row when it stops. A resolution carries the administrator's
address.
2026-11-07 14:36:44 +03:00
catborise
528b4492f6 fix(logs): a row says what happened: a recovered migration, a failed clone step, a device not there
- A migration whose libvirt call failed but which recovery finds moved (or
  cannot tell) gets a row of that end; only a failure already logged by
  migrate_instance is not logged twice.
- A clone made with its resize or start failed, and a recovered migration
  whose autostart or NVRAM step failed, write a failed row of that step, as
  migrate_instance does for its later steps.
- Setting the link state of an interface or the video model of a VM that
  has none is refused: it changed nothing and was logged as done.
- The rows of a removed VM record (deleted or expired) name its host, VM
  and UUID, so the VM's history has them.
2026-11-07 14:36:34 +03:00
catborise
0610c23a34 fix(api): an error's status says what it is, and its body is always {"detail"}
- libvirt errors all answered 400. A VM, pool or volume the host does not
  have now answers 404, a volume in use 409 (vrtManager.util.InUse) and a
  host that cannot be reached 503, which a client may retry.
- A template's power on or cycle and a stopped pool answered
  {"status": ...} with 409; they answer {"detail": ...}, as every other
  refusal. The schema documents these 409s (ErrorSerializer).
- The volume list and a volume of a stopped pool answered 200 with an
  empty list or a made-up volume; they answer 409.
- An API URL that names nothing answered the HTML error page; it answers
  a JSON 404 after the API's authentication.
- A session that must change its password was redirected to the HTML
  form; an API request of it gets the JSON 403 a token gets.
2026-11-07 13:29:46 +03:00
catborise
6d22a18ba7 fix(i18n): refusals and checks users read are translated
English-only texts users read, now in their language:
- the serial console's four refusals, which socketiod sends in the
  language LocaleMiddleware would choose (cookie, then browser) and logs
  in English; the texts live in console/refusals.py, as makemessages
  reads only .py files;
- a submission key reused for another request, a malformed MAC address,
  the moved-VM refusal of a script's request, the API's "Templates
  cannot be started" (now the page's sentence), "Pool is not active"
  and the ISO upload's checks;
- "Problem occurred with host" was a fragment with the host's name and
  error after it: one sentence with both.
2026-11-06 23:48:53 +03:00
catborise
6abea495f1 fix(logs): failures name their job, VM and user; the new VM form shows a list it could not load
- A failed cancel hook logged "worker task cancel failed": it now names
  the job, its kind, resource and user, with the traceback for a fault
  of the panel.
- novncd logged "Console connection failed" without the VM or the user.
- django-axes wrote four INFO lines a login ("Reset 0 access
  attempts"...); logins are on the Logs page, so it logs warnings only.
- The new VM form's machine types and disk buses answered 200 with an
  empty object when libvirt failed, and nothing was logged: the list
  stayed empty, the form could not go on and said nothing. They answer
  400 with the error, as the pool's volume list does, the warning is
  logged with the compute, and the form's lists show an error they get
  with the page's messages.
2026-11-06 23:48:44 +03:00
catborise
432b1505b3 fix(operations): a job's unexpected error is not shown raw; the log has its traceback
A job that failed on an exception that is not libvirt's or a refusal
showed its raw text to users (a SQL error such as "UNIQUE constraint
failed: instances_instance.uuid", a KeyError's key), and the worker
logged only that text. Users now read "The panel failed unexpectedly;
its log has the details." and the worker logs the exception with its
traceback.

A live clone whose recovery found the clone made but could not thaw the
source's file systems kept that in the error of a succeeded job, which
the job panel does not show. It is a warning of the clone's result, as
when the job itself made the clone.
2026-11-06 23:48:44 +03:00
catborise
1f9347e148 fix(instances): a new VM and each clone get a VNC password of their own
Since the VM create became a job (6f0c7300) every new VM was defined with
no VNC password, and a clone copied its source's password (or its lack
of one) exactly: every clone of a template shared it. Computes listen
for VNC on all their addresses (dev/libvirt-bootstrap.sh), so anyone who
could reach a compute's VNC ports opened any of these consoles directly,
without the panel; the README's firewall rule was the only guard.

The create job asks for create.py's random 8-character password again,
and a clone's VNC graphics get a new random one. The console page sends
the password to a user with passwordless_console, which the user create
form now ticks by default next to change_password; a user without it is
asked for the password, as the permission intends. Existing VMs keep
their settings.

Live create, clone and VM page tests pass on a TCP compute.
2026-11-06 20:00:43 +03:00
catborise
f996b03ed1 test: the live VM page tests run the delete job
Since deleting a VM became a job (#431), the delete page queues it and
returns to the VM page; the live VM page tests still expected the VM
gone at once and a redirect to the list, so they failed, and the VMs
they left behind failed later tests. They now run the queued job and
check the VM is gone.
2026-11-06 13:48:04 +03:00
catborise
f3003bb414 test: test files named by their topic, one file per topic
- console settings were split over four files; who sees the form, the
  listen address, and the settings themselves are test_console_settings,
  and who may open a console is test_console_access;
- the three template files are test_templates;
- the quota lock test joins test_quota;
- accounts' test_security_fixes held two topics: the SSH key tests are
  test_ssh_keys, the owner-row delete redirect is in test_views;
- instances' test_security_mutations, who may change a VM, is
  test_permissions.
The suite runs the same 2097 tests.
2026-11-06 13:48:04 +03:00
catborise
bdc8a6755c test: each test is in the tests package of the code it tests
Tests that build vrtManager objects and touch no view, form or model of
an app lived in that app; vrtManager/tests already holds such tests, so
the convention was split. They move to vrtManager/tests: the firmware,
CPU mode and PCIe port definitions of a new VM (test_create), USB and PCI
host devices, the console listener, host CPU reads, interface reads,
deletes and XML, network filters, PCI passthrough rules, node devices,
network changes, addresses and leases, pool XML, secrets, and the live
tests that use vrtManager only (disk resize, ISO, snapshots, XML, live
clone). livetest.py, the live-test helper six apps import, and the
network test driver move with them.

Others go to their app: the quota with a host down to instances, the
401/403 Logs rows (webvirtcloud's middleware) to webvirtcloud, the VM
page's tab script test to instances, novncd's own tests out of the
console views tests, the compute lock and input validation tests out of
the computes views tests, the interface views out of the forms tests.
instances/tests/test_views.py, entirely live, is test_live_views.py.

Test modules imported fixtures from each other; shared ones are now in
vrtManager/tests/fakes.py (migration fakes, node devices, IOMMU groups,
leases, a NAT network, a Ceph secret), interfaces/tests/fakes.py,
console/tests/daemons.py (novncd loaded once), livetest.wait_for and
instances/tests/create_page.BODY. Every live test checks
livetest.enabled(). The suite runs the same 2097 tests.
2026-11-06 13:48:04 +03:00