1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-02 08:56:07 +00:00
Commit graph

2181 commits

Author SHA1 Message Date
catborise
4ef6bd820c docs(readme): the docker stop command names the container
docker stop -t 95 without a container fails with "requires at least 1
argument"; compose names it webvirtcloud.
2026-11-08 18:01:30 +03:00
catborise
87f1d03c0f docs(readme): moving a PostgreSQL panel leaves out the SQLite restore
Both blocks of Moving to a new machine restore $b/db.sqlite3, which a
backup of a PostgreSQL panel does not have, so the chain stopped there.
The section says to restore PostgreSQL by hand and leave that line out.
2026-11-08 18:01:30 +03:00
catborise
bab9294af4 docs(readme): moving to a new machine copies an empty ssh backup too
The installer block copied the backup's SSH keys with cp "$b"/ssh/*:
a backup of a panel without keys has an empty ssh/ directory, the glob
stays unexpanded, cp fails and the rest of the && chain is skipped. It
copies the directory's contents as the pki line does.
2026-11-08 18:01:30 +03:00
catborise
fc96ddbbd0 docs(readme): manage.py commands run with the panel's venv and user
The password reset and the behaviour changes' session and lockout
commands ran a bare python3 manage.py, which on an installer host fails
with "Couldn't import Django" (the packages are in the venv) and had no
Docker form. They name the venv's python as the web service user, and
the Docker exec form.
2026-11-08 18:01:30 +03:00
catborise
3b86dcebf5 ci: the Docker image is built with a layer cache
Each run built the image from nothing, compiling libvirt-python and
python-ldap again. Buildx keeps the layers in GitHub's cache, so a run
that changes only code rebuilds only the last stage.
2026-11-08 16:09:21 +03:00
catborise
39a3497d28 build(docker): docker-compose.yml leaves out Compose's defaults
build named the default Dockerfile and each volume the default local
driver. The resolved config is the same; the volumes keep their names.
2026-11-08 16:09:21 +03:00
catborise
68ba2add9c build(docker): the build context leaves out docs, CI and the host installers
The image took .github, doc, dev, the installer scripts, the Vagrantfile
and the ruff cache, and a rotated log (*.log.1) of a used checkout. The
list is now grouped by why a file stays out, without the entries for
tools this repository does not use.
2026-11-08 16:09:21 +03:00
catborise
fe6395b9ce build(docker): gunicorn runs 4 workers in the image
gunicorn.conf.py starts 2 x CPUs + 1 workers, at most 8, about 140 MB
each: 1.1 GB on the deployed host for a panel. The image now runs 4,
which still sends up to 8 requests at a time to one compute and leaves
threads for the others when one hangs. GUNICORN_CMD_ARGS in
docker-compose.override.yml sets another number; installs outside
Docker keep their default.
2026-11-08 16:09:21 +03:00
catborise
1fd5fe0d42 build(docker): the image is Ubuntu 26.04 with supervisord in place of phusion's runit
phusion/baseimage brought sshd, syslog-ng, my_init and runit's per
service scripts, and an nginx log forwarder tailing a file. The image
is now ubuntu:26.04 with Ubuntu's supervisor: conf/docker holds the
start script (settings, secret key, ownership, migrations as www-data),
one supervisord.conf for the six processes, nginx's config with errors
to docker logs, the backup's cron line and the health check. A stop
signals every process at once, so the worker keeps its 60 s drain
within the 95 s grace. The same volumes and container name work as
before; README runs commands with exec -u www-data in place of
/sbin/setuser. The image goes from 805 MB to 642 MB.
2026-11-08 16:09:21 +03:00
catborise
a76f42aa5a build(docker): the image has one copy of the venv and no pip
chown -R www-data on /srv/webvirtcloud after collectstatic copied the
venv and the code into a layer of their own. The code now stays root's:
the panel writes only to its data and backup directories, which the
start script gives it. pip is removed from the runtime venv and its
cache is a build cache mount, so a requirement change downloads only
what changed. The image goes from 1.17 GB to 805 MB.
2026-11-08 15:57:33 +03:00
catborise
d19151b88e refactor(vrtManager): instance.py imports libvirt's names without a fallback
When the import of libvirt's names failed, the except branch imported
four of them and left the module to fail later on any other one with a
NameError. libvirt-python always has them; the import is a plain one.
2026-11-08 14:44:09 +03:00
catborise
c26ff69b3f refactor(vrtManager): the connection manager locks its dict with threading.RLock
The 223-line read-write lock guarded only the dict of connections, a
lookup of a few entries: readers never waited on a long writer, as the
connection is opened outside the lock. One reentrant lock does the same.
2026-11-08 14:43:33 +03:00
catborise
8e24e2ad44 fix(vrtManager): a new VM's disk path, network and filter names are XML text
create_instance put an existing volume's path and the network and
filter names into the domain XML unescaped, so a quote or ampersand,
which libvirt allows in them, broke the VM's XML. They are escaped as
attach_disk does.
2026-11-08 14:42:47 +03:00
catborise
021d75102e 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.
2026-11-08 14:42:20 +03:00
catborise
38b5306fee fix(vrtManager): an ISO put in a host CD-ROM drive is read
A CD-ROM of type block (a host drive) kept its type when an ISO was
inserted, and libvirt reads only source/@dev for that type, so the drive
stayed empty. Inserting an ISO now makes it a file drive.
2026-11-08 14:40:26 +03:00
catborise
d567bbf687 fix(vrtManager): a vCPU maximum the CPU topology does not make is refused first
A VM with a CPU topology takes only the maximum it makes; libvirt
refused another one after the vCPU hotplug list had been removed, so a
failed resize left hotplug off. The maximum is now checked against the
topology before anything changes, with tr and zh translations.
2026-11-08 14:40:06 +03:00
catborise
b90b632a09 fix(vrtManager): a NIC's edit keeps the parameters of its filter
Saving a NIC's settings replaced its filterref even when the filter
stayed the same, so its parameters were lost: clean-traffic with a
fixed IP went back to learning the address at the next start. The same
filter now keeps its element; another filter replaces it.
2026-11-08 14:38:53 +03:00
catborise
7dbfc5d6fd fix(storages): a volume's copy is not offered as qcow
QEMU no longer creates images of the first qcow format: qemu-img stops
with "Unknown file format 'qcow'", so converting a copy to it always
failed. The choice is gone.
2026-11-08 14:36:52 +03:00
catborise
013b41feff 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.
2026-11-08 14:35:19 +03:00
catborise
3f13a34665 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.
2026-11-08 14:34:51 +03:00
catborise
ec6480ed66 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.
2026-11-08 14:33:10 +03:00
catborise
a1ed639999 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.
2026-11-08 12:24:47 +03:00
catborise
72d00f8237 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.
2026-11-08 12:24:18 +03:00
catborise
c381cdc8b9 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.
2026-11-08 12:20:17 +03:00
catborise
faa896ca54 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.
2026-11-08 12:19:29 +03:00
catborise
4d37e65c03 refactor(vrtManager): validate_macaddr checks the type once
It tested isinstance(val, str) twice, a leftover of the Python 2 str/unicode check.
2026-11-08 12:16:50 +03:00
catborise
393e0be82c 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.
2026-11-08 12:16:44 +03:00
catborise
81395b6a22 refactor(vrtManager): remove the pool allocation, available and capacity getters
Nothing calls wvmStorage.get_allocation(), get_available() or get_capacity(); the pages read a pool's space with get_size(), one info call.
2026-11-08 12:16:19 +03:00
catborise
13107deecc 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.
2026-11-08 12:15:33 +03:00
catborise
10996086e7 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.
2026-11-08 12:09:23 +03:00
catborise
b3eb13a980 perf(vrtManager): the domain capabilities and each pool's XML are parsed once
get_dom_capabilities() parsed the same domain capabilities XML for each of its 14 reads, and the pool list parsed each pool's XML for its type, its path and its source name. Each is now parsed once and read with get_xpath().
2026-11-08 12:06:37 +03:00
catborise
7c408673a1 perf(computes): a host's CPU count and memory come from its cached info
cpu_count and ram_size each called get_node_info(), which also reads the hostname, the sysinfo XML and the URI, for one value. Both now take it from host_info, the getInfo() read the proxy keeps.
2026-11-08 12:05:19 +03:00
catborise
7be3a1b1d7 perf(nwfilters): a filter's page takes the filter names from the listing it already reads
The page listed the host's filters twice: once for their names and once for the filters with their references. The names now come from the second listing.
2026-11-08 12:04:35 +03:00
catborise
488a8e7519 perf(vrtManager): a pool's size is read with one info call
get_size() called pool.info() twice for its capacity and free space, two libvirt calls on every pool page and API read.
2026-11-08 12:03:39 +03:00
catborise
e151d7d8d1 perf(storages): the pool page does not list the host's pools
The page computed storages = conn.get_storages(), two libvirt listings on every load and POST, and never used it.
2026-11-08 12:02:49 +03:00
catborise
cdc9f9ceb4 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.
2026-11-08 12:02:18 +03:00
catborise
32e8ff3c11 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.
2026-11-07 23:58:50 +03:00
catborise
e2b038f3fa fix(instances): a VM with an SMBIOS UUID can be cloned
The clone took a new UUID but kept the VM's in its SMBIOS system
information, and libvirt refused the definition (UUID mismatch between
<uuid> and <sysinfo>). The SMBIOS entry takes the clone's UUID.
2026-11-07 23:56:04 +03:00
catborise
ae5fe5216c fix(instances): a clone's TPM is a new one, never the VM's state
A shut-off clone kept the VM's TPM element as it was: an emulated TPM
with a state path of its own, a host's TPM or an external one would be
shared with the VM, not the new, empty TPM the clone form promises. An
emulated TPM loses its state path, and the others are refused.
2026-11-07 23:56:04 +03:00
catborise
60e8a15203 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.
2026-11-07 23:56:04 +03:00
catborise
5986702859 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.
2026-11-07 23:56:04 +03:00
catborise
f5739c1727 fix(instances): the clone form names each extensionless disk apart
A disk name without an extension that did not start with the VM's name,
as LVM volumes have, became the clone's name alone: two such disks got
the same name and the clone failed on the second. Each is the clone's
name and the disk's.
2026-11-07 23:56:04 +03:00
catborise
b1c6281af9 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.
2026-11-07 23:56:04 +03:00
catborise
164424c68a fix(storages): a volume a running VM uses is not cloned
The copy was read while the guest wrote: a raw disk was copied with
data of different instants, and a qcow2 one failed on qemu-img's image
lock with a message that did not say why. Such a clone is refused, with
the running VMs named, when it is queued and again before it runs.
2026-11-07 23:56:04 +03:00
catborise
3c5aac2911 fix(migrate): a shut-off VM whose NVRAM file is outside libvirt's directory is refused
Only a file in libvirt's NVRAM directory was copied; one elsewhere was
skipped without a word, and the VM started on the destination from the
firmware's template, its saved boot entries lost. Such a VM is now
refused before anything changes.
2026-11-07 23:10:19 +03:00
catborise
7566ecf81a 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.
2026-11-07 23:10:19 +03:00
catborise
966a6c8510 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.
2026-11-07 23:10:19 +03:00
catborise
cf0c586572 fix(migrate): the next start's definition names a copied disk under its new path
A copied disk was found by its target as well as its path: after a bus
change waiting for the next start (vda to sda), the next start's
definition kept the source path, which the destination does not have,
and the VM would not start again there. The path alone finds it, so two
disks of one file can no longer be copied to two places.
2026-11-07 23:10:19 +03:00
catborise
0eb8e8282e 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.
2026-11-07 22:51:25 +03:00
catborise
d90a967ba6 fix(migrate): a disk of an LVM or disk pool does not count as shared with the destination
Each host's logical volumes are its own: a VM whose disk is /dev/vg/x
migrated, uncopied, onto the destination's volume of the same name and
kept running on other data. Such a volume now counts as missing there.
2026-11-07 22:39:26 +03:00