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

fix(instances): a busy host is reported as busy, not as unreachable

A web request refused because this process's requests to the host
(HOST_REQUESTS) all still wait for it raised the same ConnectionFailed as
a host that is down, so the VM page said the host cannot be reached. It
now raises HostBusy; the VM page and the error users who do not see hosts
get say the host is busy and to try again in a moment.
This commit is contained in:
catborise 2026-11-05 15:53:29 +03:00
parent 458074df82
commit f3c44f18c4
9 changed files with 307 additions and 245 deletions

View file

@ -144,8 +144,8 @@ def _count_on(connection):
_leave_host()
if not connection.requests.acquire(timeout=CONNECT_TIMEOUT):
logger.warning("%s: request refused, %s requests still wait for the host", connection.host, HOST_REQUESTS)
raise util.ConnectionFailed(gettext_noop("Connection Failed: %(host)s does not answer: %(requests)s requests still wait for it"),
host=connection.host, requests=HOST_REQUESTS)
raise util.HostBusy(gettext_noop("Connection Failed: %(host)s does not answer: %(requests)s requests still wait for it"),
host=connection.host, requests=HOST_REQUESTS)
_request.held = connection

View file

@ -56,6 +56,11 @@ class ConnectionFailed(OperationError):
is reached."""
class HostBusy(ConnectionFailed):
"""The host is connected, but this process's web requests to it
(HOST_REQUESTS) still wait for its answers."""
def is_kvm_available(xml):
kvm_domains = get_xml_path(xml, "//domain/@type='kvm'")
return kvm_domains > 0