Skip to content

Commit

Permalink
Add websockify as Kimchi dependency
Browse files Browse the repository at this point in the history
websockify is present in all supported Linux distributions (RHEL6.5,
RHEL7, Fedora20, Ubuntu 14.04 and openSUSE 13.1) so instead of importing
its code into Kimchi source source structure we must add its package as
a Kimchi dependency and use it as is.

Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com>
  • Loading branch information
alinefm committed Oct 7, 2014
1 parent e41e2b8 commit 613650d
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ EXTRA_DIST = \
$(NULL)


PEP8_BLACKLIST = src/kimchi/config.py,src/kimchi/i18n.py,src/kimchi/websocket.py,src/kimchi/websockify.py,tests/test_config.py
PEP8_BLACKLIST = src/kimchi/config.py,src/kimchi/i18n.py,tests/test_config.py

SKIP_PYFLAKES_ERR = "\./src/kimchi/websocket\.py"

Expand Down
1 change: 1 addition & 0 deletions contrib/DEBIAN/control.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Architecture: all
Depends: python-cherrypy3 (>= 3.2.0),
python-cheetah,
python-imaging,
websockify,
python-jsonschema (>= 1.3.0),
python-libvirt,
gettext,
Expand Down
1 change: 1 addition & 0 deletions contrib/kimchi.spec.fedora.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Requires: libvirt
Requires: libvirt-python
Requires: python-cherrypy >= 3.2.0
Requires: python-cheetah
Requires: python-websockify
Requires: m2crypto
Requires: python-imaging
Requires: libxml2-python
Expand Down
1 change: 1 addition & 0 deletions contrib/kimchi.spec.suse.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Requires: libvirt
Requires: libvirt-python
Requires: python-CherryPy >= 3.2.0
Requires: python-Cheetah
Requires: python-websockify
Requires: python-imaging
Requires: python-M2Crypto
Requires: python-libxml2
Expand Down
7 changes: 4 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Install Dependencies
python-ipaddr python-lxml nfs-utils \
iscsi-initiator-utils libxslt pyparted nginx \
policycoreutils-python python-libguestfs \
libguestfs-tools python-requests
libguestfs-tools python-requests python-websockify
# If using RHEL6, install the following additional packages:
$ sudo yum install python-unittest2 python-ordereddict
# Restart libvirt to allow configuration changes to take effect
Expand All @@ -79,7 +79,7 @@ for more information on how to configure your system to access this repository.
sosreport python-ipaddr python-lxml nfs-common \
open-iscsi lvm2 xsltproc python-parted nginx \
firewalld python-guestfs libguestfs-tools \
python-requests
python-requests websockify

Packages version requirement:
python-jsonschema >= 1.3.0
Expand All @@ -94,7 +94,8 @@ for more information on how to configure your system to access this repository.
rpm-build kvm python-psutil python-ethtool \
python-ipaddr python-lxml nfs-client open-iscsi \
libxslt-tools python-xml python-parted nginx \
python-libguestfs guestfs-tools python-requests
python-libguestfs guestfs-tools python-requests \
python-websockify

Packages version requirement:
python-psutil >= 0.6.0
Expand Down
2 changes: 1 addition & 1 deletion src/kimchi/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def __init__(self, options):

if isinstance(model_instance, model.Model):
vnc_ws_proxy = vnc.new_ws_proxy()
cherrypy.engine.subscribe('exit', vnc_ws_proxy.kill)
cherrypy.engine.subscribe('exit', vnc_ws_proxy.terminate)

for ident, node in sub_nodes.items():
if node.url_auth:
Expand Down
22 changes: 14 additions & 8 deletions src/kimchi/vnc.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
import base64
import errno
import os
import subprocess

from multiprocessing import Process
from websockify import WebSocketProxy

from kimchi.config import config, paths

Expand All @@ -43,13 +44,18 @@ def new_ws_proxy():
cert = '%s/kimchi-cert.pem' % paths.conf_dir
key = '%s/kimchi-key.pem' % paths.conf_dir

cmd = os.path.join(os.path.dirname(__file__), 'websockify.py')
args = ['python', cmd, config.get('display', 'display_proxy_port'),
'--target-config', WS_TOKENS_DIR, '--cert', cert, '--key', key,
'--web', os.path.join(paths.ui_dir, 'pages/websockify'),
'--ssl-only']
p = subprocess.Popen(args, close_fds=True)
return p
params = {'web': os.path.join(paths.ui_dir, 'pages/websockify'),
'listen_port': config.get('display', 'display_proxy_port'),
'target_cfg': WS_TOKENS_DIR,
'key': key, 'cert': cert, 'ssl_only': True}

def start_proxy():
server = WebSocketProxy(**params)
server.start_server()

proc = Process(target=start_proxy)
proc.start()
return proc


def add_proxy_token(name, port):
Expand Down

0 comments on commit 613650d

Please sign in to comment.