Reviewed-By: Lucio Correia <luciojhc(a)linux.vnet.ibm.com>
On 04-02-2016 17:47, Jose Ricardo Ziviani wrote:
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 (6):
Rename vnc.py to websocket.py
Implement the web serial console server
Implement the backend to support web serial console
Implement the web serial console front-end
Implement the Kimchi front-end for the web serial console
Add test case for the socket server
control/vms.py | 3 +-
i18n.py | 4 +-
kimchi.conf | 6 +
model/vms.py | 43 +-
root.py | 8 +-
serial_console.py | 291 ++
tests/test_model.py | 30 +-
ui/js/src/kimchi.api.js | 25 +
ui/js/src/kimchi.guest_main.js | 16 +-
ui/pages/guest.html.tmpl | 5 +-
ui/serial/images/favicon.ico | Bin 0 -> 15086 bytes
ui/serial/images/logo-white.png | Bin 0 -> 7583 bytes
ui/serial/serial.html | 80 +
ui/serial/term.js | 5973 +++++++++++++++++++++++++++++++++++++++
vnc.py | 92 -
websocket.py | 122 +
16 files changed, 6587 insertions(+), 111 deletions(-)
create mode 100644 serial_console.py
create mode 100644 ui/serial/images/favicon.ico
create mode 100644 ui/serial/images/logo-white.png
create mode 100644 ui/serial/serial.html
create mode 100644 ui/serial/term.js
delete mode 100644 vnc.py
create mode 100644 websocket.py
--
Lucio Correia
Software Engineer
IBM LTC Brazil