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

fix(console): a serial paste and its echo no longer wait on each other

- socketiod wrote input to the worker's terminal while holding the
  session's lock, and the write could wait for the worker; the output
  forwarder needs that lock. A large paste into a guest that echoes it
  could stop both for good. The terminal is now non-blocking: input is
  written as far as the worker takes it, and the wait for room is outside
  the lock.
- The terminal is raw from the start. Until the worker made it raw, it
  kept at most one 4 KiB line of a paste, and the worker's own setraw
  dropped what was typed meanwhile; the worker no longer sets it.
- A superuser's takeover ends the old worker, and waits for it, before
  starting the new one: libvirt gives a VM's console to one at a time.
- A resize while the worker ends no longer raises.
This commit is contained in:
catborise 2026-10-26 21:45:59 +03:00
parent 69ddbbdc94
commit 060a3cc86b
3 changed files with 91 additions and 21 deletions

View file

@ -3,11 +3,12 @@
# (socketiod runs it in a pty, one per client). It opens the console through
# the compute's connection (its stored credentials); the connection's event
# loop thread runs the stream callbacks. The console survives guest reboots.
# socketiod made the terminal raw before starting it (setting it here would
# drop what the user typed meanwhile).
import os
import sys
import time
import tty
import django
@ -117,7 +118,6 @@ def main():
c = instance.compute
try:
console = Console(connection_manager.get_connection(c.hostname, c.login, c.password, c.type), instance.uuid)
tty.setraw(0) # before the console opens: nothing typed is echoed by the terminal
console.check()
except libvirt.libvirtError as err:
say("Cannot open the console of %s: %s" % (instance.name, public_error_text(err)))