[Kimchi-devel] [PATCH v3 2/4] Add a configuration for vnc websocket proxy

Mark Wu wudxw at linux.vnet.ibm.com
Tue Jan 7 08:56:40 UTC 2014


We are going to use one proxy instance to forward all vm's
vnc traffics. The proxy instance listens on a fixed port instead
of a random one. This patch makes the port configurable and exported
to client by adding it to the response of '/config'.

Signed-off-by: Mark Wu <wudxw at linux.vnet.ibm.com>
---
 docs/API.md                  | 1 +
 src/kimchi.conf.in           | 4 ++++
 src/kimchi/config.py.in      | 2 ++
 src/kimchi/control/config.py | 4 +++-
 4 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/docs/API.md b/docs/API.md
index 0013e86..4d7bdff 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -432,6 +432,7 @@ Contains information about the application environment and configuration.
 
 * **GET**: Retrieve configuration information
     * http_port: The port number on which the server is listening
+    * vnc_proxy_port: Port for vnc's websocket proxy to listen on
 * **POST**: *See Configuration Actions*
 
 **Actions (POST):**
diff --git a/src/kimchi.conf.in b/src/kimchi.conf.in
index bf26c26..ac5a1f5 100644
--- a/src/kimchi.conf.in
+++ b/src/kimchi.conf.in
@@ -29,3 +29,7 @@
 
 # Logging level: debug, info, warning, error or critical
 #log_level = debug
+
+[novnc]
+# Port for vnc's websocket proxy to listen on
+#vnc_proxy_port = 64667
diff --git a/src/kimchi/config.py.in b/src/kimchi/config.py.in
index 72308ff..e1319e3 100644
--- a/src/kimchi/config.py.in
+++ b/src/kimchi/config.py.in
@@ -179,6 +179,8 @@ def _get_config():
     config.add_section("logging")
     config.set("logging", "log_dir", get_default_log_dir())
     config.set("logging", "log_level", DEFAULT_LOG_LEVEL)
+    config.add_section("novnc")
+    config.set("novnc", "vnc_proxy_port", "64667")
 
     if os.path.exists(CONFIG_FILE):
         config.read(CONFIG_FILE)
diff --git a/src/kimchi/control/config.py b/src/kimchi/control/config.py
index 3630172..5186ddd 100644
--- a/src/kimchi/control/config.py
+++ b/src/kimchi/control/config.py
@@ -25,6 +25,7 @@
 import cherrypy
 
 
+from kimchi.config import config
 from kimchi.control.base import Collection, Resource
 
 
@@ -38,7 +39,8 @@ class Config(Resource):
 
     @property
     def data(self):
-        return {'http_port': cherrypy.server.socket_port}
+        return {'http_port': cherrypy.server.socket_port,
+                'vnc_proxy_port': config.get('novnc', 'vnc_proxy_port')}
 
 
 class Capabilities(Resource):
-- 
1.8.4.2




More information about the Kimchi-devel mailing list