
Hello Aline, Libvirt doesn't return anything about it (and makes sense because the connection to the serial was done, but nothing is being send to that). However I can add a 'smart' timeout: once a the connection is opened, if we don't listen anything back from the VM in, let's say 5 seconds, I send a message to the client. On 14-02-2016 23:46, Aline Manera wrote:
Reviewed-by: Aline Manera <alinefm@linux.vnet.ibm.com> Tested-by: Aline Manera <alinefm@linux.vnet.ibm.com>
Is there a way to know the serial connection failed? For example, due the missing 'console' kernel option. In that case, it'd be good to display an error/warning message in the serial.html page.
"Unable to connect to serial console. Please, verify your virtual machine has 'console=ttyS0,115200' kernel option set."
Ziviani, do you think it is possible to do?
Regards, Aline Manera
On 02/12/2016 10:42 PM, Jose Ricardo Ziviani wrote:
v5: - fixed test config + '/serial': { + 'tools.nocache.on': True, + 'tools.wokauth.on': True, + 'tools.staticdir.dir': paths.serial_dir, + 'tools.staticdir.on': True + },
- fixed parent method calling from websocket.py def get_target(self, target_plugin, path): - target = super(CustomHandler, self).get_target(target_plugin, path) + if issubclass(CustomHandler, object): + target = super(CustomHandler, self).get_target(target_plugin, + path) + else: + target = request_proxy.get_target(self, target_plugin, path) +
v4: - fix patch encoding to utf-8
v3: - applied code review - removed favicon from this patch
v2: - applied code review - updated the build system
This is the initial version of a web serial console for kimchi/libvirt VMs.
When a VM is turned on, a new action is displayed named "Connect Serial", this will open a new tab with an interface like the existing novnc.
That interface opens a websocket to kimchi webserver (nginx), then it is redirected to websockify. Websockify will proxy that connection to a local unix socket server to finally communicate with the guest console.
I chose to create one server per guest because that's the way websockify was designed (it was born inside novnc), so I could reuse the token security plugin implemented in websockify. In order to avoid wasting resources I decided to user unix socket, a local/lightweight/reliable socket if compared with internet sockets, this uses files instead of ports to accept connections.
When a connection is established no one else can get that console (I'm not multiplexing it but it's possible in future). The serial console will be available again if the current user does one of: - type ctrl+q - close the tab - 2 min. timeout
Thanks
Jose Ricardo Ziviani (8): Rename vnc.py to websocket.py Implement the web serial console server Implement the backend to support web serial console Import term.js to Kimchi project Implement the web serial console front-end Implement the Kimchi front-end for the web serial console Update the build system to make the serial console Add test case for the socket server
COPYING | 2 + Makefile.am | 4 +- config.py.in | 6 +- configure.ac | 3 + control/vms.py | 3 +- i18n.py | 3 + model/vms.py | 43 +- root.py | 6 +- serialconsole.py | 315 +++ tests/test_config.py.in | 6 + tests/test_model.py | 28 +- ui/Makefile.am | 2 +- ui/js/src/kimchi.api.js | 27 + ui/js/src/kimchi.guest_main.js | 14 +- ui/pages/guest.html.tmpl | 5 +- ui/serial/Makefile.am | 21 + ui/serial/html/Makefile.am | 21 + ui/serial/html/serial.html | 99 + ui/serial/libs/Makefile.am | 21 + ui/serial/libs/term.js | 5973 ++++++++++++++++++++++++++++++++++++++++ vnc.py | 92 - websocket.py | 127 + 22 files changed, 6711 insertions(+), 110 deletions(-) create mode 100644 serialconsole.py create mode 100644 ui/serial/Makefile.am create mode 100644 ui/serial/html/Makefile.am create mode 100644 ui/serial/html/serial.html create mode 100644 ui/serial/libs/Makefile.am create mode 100644 ui/serial/libs/term.js delete mode 100644 vnc.py create mode 100644 websocket.py
-- Jose Ricardo Ziviani ----------------------------- Software Engineer Linux Technology Center - IBM