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

feat(instances): choose VNC or the serial console on the VM page

Settings > Console gets a Console type field. Serial removes the VM's
graphics device (adding a pty console when there is none); VNC adds the
graphics device new VMs get, on localhost, and then applies the form's
VNC fields, so an administrator can open it to all interfaces for a TCP
compute. Serial is offered only while SERIAL_CONSOLE_ENABLED is on.
This commit is contained in:
catborise 2026-10-17 18:43:39 +03:00
parent d37aa42392
commit 0f9bbd3e86
6 changed files with 53 additions and 3 deletions

View file

@ -105,6 +105,16 @@ EDITS = {
lambda t: first(t, "devices/graphics/listen/@address") == "127.0.0.1",
["devices/graphics/@listen", "devices/graphics/listen/@address"], True, False,
),
"set_console_type pty": (
lambda vm: vm.set_console_type("pty"),
lambda t: not t.xpath("devices/graphics") and first(t, "devices/console/@type") == "pty",
["devices/graphics", "devices/console"], True, False,
),
"set_console_type vnc": (
lambda vm: vm.set_console_type("vnc"),
lambda t: t.xpath("devices/graphics/@type") == ["vnc"] and first(t, "devices/graphics/@listen") == "127.0.0.1",
["devices/graphics"], True, False,
),
"set_console_passwd": (
lambda vm: vm.set_console_passwd("new12345"),
lambda t: first(t, "devices/graphics/@passwd") == "new12345",