mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-11 12:46:49 +00:00
fix(console): the console page connects only to the panel's own proxy
- The lite VNC page took the proxy's host, port and path from its link. A link naming another host made the page send that host a fresh signed console token, which opened the VM's console for two minutes. The page now uses only what the server gives it, like the full page. - On a local-socket host, a VM whose console listens on 127.0.0.1 is reached directly instead of being refused for want of an SSH tunnel. - A shut-off VM's console says that the VM is not running instead of failing with no reason.
This commit is contained in:
parent
93d3cc7238
commit
5b24f9a6f8
4 changed files with 54 additions and 14 deletions
|
|
@ -105,7 +105,9 @@ def console(request):
|
|||
console_type = conn.get_console_type()
|
||||
console_websocket_port = conn.get_console_websocket_port()
|
||||
console_passwd = conn.get_console_passwd()
|
||||
running = conn.instance.isActive()
|
||||
except (libvirtError, ValueError, IndexError, Instance.DoesNotExist):
|
||||
running = False
|
||||
console_type = None
|
||||
console_websocket_port = None
|
||||
console_passwd = None
|
||||
|
|
@ -124,7 +126,10 @@ def console(request):
|
|||
if ws_path:
|
||||
ws_path = ws_path.strip("/") + "/" if ws_path.strip("/") else ""
|
||||
|
||||
if console_type == "vnc":
|
||||
if console_type and not running: # a shut-off VM has no console to connect to
|
||||
console_error = _("The VM is not running: start it to open its console.")
|
||||
response = render(request, "console-vnc-lite.html", locals())
|
||||
elif console_type == "vnc":
|
||||
console_page = "console-vnc-" + view_type + ".html"
|
||||
response = render(request, console_page, locals())
|
||||
elif console_type == "pty" and not settings.SERIAL_CONSOLE_ENABLED:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue