1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-08 19:26:48 +00:00
webvirtcloud/vrtManager
catborise 10b46afd36 fix(vrtManager): libvirt connections open within a time limit
libvirt has no timeout for opening a connection. Measured in the test
setup: an unreachable host blocked qemu+tcp for 135 s and qemu+ssh for
133 s; a daemon that accepts and never answers blocks forever. Gunicorn
runs sync workers and the instance list connects to every compute, so
one unreachable compute held a worker for minutes per page load.

- A connection is opened in a helper thread, at most one per
  connection at a time. The request waits LIBVIRT_CONNECT_TIMEOUT
  (default 5 s). An open nobody waits for any more keeps running; until
  it ends, requests get its error at once, and if it succeeds later the
  connection is used. A failed open is not repeated for
  LIBVIRT_RETRY_AFTER (default 30 s). A stuck host holds one thread and
  does not keep other hosts from connecting.
- qemu+ssh runs ssh through vrtManager/libvirt-ssh (the URI's command
  parameter), which adds ConnectTimeout=10 and BatchMode=yes, so an
  abandoned ssh process ends and no prompt can hang. The user's ssh
  configuration (aliases, ProxyJump, keys) still applies.
- The close callback acts only for the connection it was registered
  for: a late callback of a replaced connection dropped its successor.
  The reason is reported as text. A connection that closed before it
  was published is an error.
- Compute.status is a bool (it returned the exception object, so the
  "host is down" check in refresh_instance_database never fired); the
  message is Compute.connection_error.

Unit tests cover the timeout, retry delay, late success, single open,
a stuck host next to a healthy one and the close callback. Live tests
(vrtManager/test_live_connection.py), for TCP and SSH computes of the
test setup: an unreachable address (no ssh left after 10 s), an endpoint
that never answers, a slow open completing later, a host that goes
silent on an established connection (keepalive ends calls within 45 s,
the next request reconnects), an ssh_config alias and a ProxyJump host.
2026-10-05 09:06:52 +03:00
..
__init__.py Initial commit 2015-02-27 10:53:51 +02:00
connection.py fix(vrtManager): libvirt connections open within a time limit 2026-10-05 09:06:52 +03:00
create.py fix(instances): CD-ROM bus, USB controller and MACs of a new VM 2026-10-04 18:33:28 +03:00
hostdetails.py fix cpu_usage waiting for instance creation. 2023-05-18 14:35:19 +03:00
instance.py fix(instances): disk and agent channel changes on paused VMs 2026-10-04 17:10:49 +03:00
interface.py fix(interfaces): validate IPv6 address and gateway of host interfaces 2026-10-04 17:29:59 +03:00
libvirt-ssh fix(vrtManager): libvirt connections open within a time limit 2026-10-05 09:06:52 +03:00
network.py feat(security): harden storage uploads and vrtManager snapshot XML handling 2026-09-27 13:28:17 +03:00
nwfilters.py format python code with black 2022-11-02 08:54:35 +03:00
rwlock.py fix(vrtManager): modernize rwlock for Python 3.12 compatibility and add tests 2026-09-24 21:49:52 +03:00
storage.py Detect RDB pools too 2025-03-14 10:31:40 +01:00
test_change_network.py chore: drop references to the local roadmap from code and tests 2026-10-04 11:09:25 +03:00
test_connection.py fix(vrtManager): libvirt connections open within a time limit 2026-10-05 09:06:52 +03:00
test_console_setters.py feat(console): VNC is the only console type 2026-10-04 01:08:11 +03:00
test_iso_media.py chore: drop references to the local roadmap from code and tests 2026-10-04 11:09:25 +03:00
test_live_connection.py fix(vrtManager): libvirt connections open within a time limit 2026-10-05 09:06:52 +03:00
test_network_ip.py test: expand unit test coverage across admin, accounts, vrtManager, logs, appsettings, and datasource 2026-09-25 11:26:53 +03:00
test_persistent_edits.py fix(instances): disk and agent channel changes on paused VMs 2026-10-04 17:10:49 +03:00
test_resize_disk.py fix(instances): domain edits start from the persistent definition 2026-10-04 01:08:11 +03:00
test_rwlock.py ci: replace super-linter with ruff 2026-10-04 01:08:11 +03:00
test_util.py fix(instances): CD-ROM bus, USB controller and MACs of a new VM 2026-10-04 18:33:28 +03:00
test_xml_safety.py chore: drop references to the local roadmap from code and tests 2026-10-04 11:09:25 +03:00
util.py fix(instances): CD-ROM bus, USB controller and MACs of a new VM 2026-10-04 18:33:28 +03:00
virtsecrets.py Django 3.2.4 LTS upgrade 2021-06-15 13:28:47 +03:00