
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 -- 1.9.1