From f5c072de1edddc4ddab89be8146a81d361397c45 Mon Sep 17 00:00:00 2001 From: Anthony Young Date: Tue, 29 Mar 2011 14:53:38 -0700 Subject: [PATCH] incorporate feedback from termie --- bin/nova-vncproxy | 4 ++-- doc/source/runnova/vncconsole.rst | 2 +- nova/api/openstack/servers.py | 2 +- nova/virt/libvirt_conn.py | 2 -- nova/vnc/__init__.py | 2 -- nova/vnc/auth.py | 4 ++-- nova/vnc/proxy.py | 4 ++-- 7 files changed, 8 insertions(+), 12 deletions(-) diff --git a/bin/nova-vncproxy b/bin/nova-vncproxy index 0fad8397dae0..ccb97e3a3f10 100755 --- a/bin/nova-vncproxy +++ b/bin/nova-vncproxy @@ -71,8 +71,6 @@ if __name__ == "__main__": LOG.audit(_("Starting nova-vnc-proxy node (version %s)"), version.version_string_with_vcs()) - service.serve() - if not (os.path.exists(FLAGS.vncproxy_wwwroot) and os.path.exists(FLAGS.vncproxy_wwwroot + '/vnc_auto.html')): LOG.info(_("Missing vncproxy_wwwroot (version %s)"), @@ -96,6 +94,8 @@ if __name__ == "__main__": else: with_auth = auth.VNCNovaAuthMiddleware(with_logging) + service.serve() + server = wsgi.Server() server.start(with_auth, FLAGS.vncproxy_port, host=FLAGS.vncproxy_host) server.wait() diff --git a/doc/source/runnova/vncconsole.rst b/doc/source/runnova/vncconsole.rst index 6d93bad93f6f..942ace61135a 100644 --- a/doc/source/runnova/vncconsole.rst +++ b/doc/source/runnova/vncconsole.rst @@ -36,7 +36,7 @@ Configuring the VNC Proxy ------------------------- nova-vnc-proxy requires a websocket enabled html client to work properly. At this time, the only tested client is a slightly modified fork of noVNC, which -you can at find git://github.com/sleepsonthefloor/noVNC.git. +you can at find http://github.com/openstack/noVNC.git .. todo:: add instruction for installing from package diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py index 8223421492f8..8170ab4a1f54 100644 --- a/nova/api/openstack/servers.py +++ b/nova/api/openstack/servers.py @@ -486,7 +486,7 @@ class Controller(wsgi.Controller): """Returns a url to an instance's ajaxterm console.""" try: self.compute_api.get_vnc_console(req.environ['nova.context'], - int(id)) + int(id)) except exception.NotFound: return faults.Fault(exc.HTTPNotFound()) return exc.HTTPAccepted() diff --git a/nova/virt/libvirt_conn.py b/nova/virt/libvirt_conn.py index 8c948950b2af..502e61395c04 100644 --- a/nova/virt/libvirt_conn.py +++ b/nova/virt/libvirt_conn.py @@ -627,8 +627,6 @@ class LibvirtConnection(driver.ComputeDriver): return {'token': token, 'host': host, 'port': port} - _image_sems = {} # FIXME: why is this here? (anthony) - @staticmethod def _cache_image(fn, target, fname, cow=False, *args, **kwargs): """Wrapper for a method that creates an image that caches the image. diff --git a/nova/vnc/__init__.py b/nova/vnc/__init__.py index 1642295ec880..2733c81d609c 100644 --- a/nova/vnc/__init__.py +++ b/nova/vnc/__init__.py @@ -20,9 +20,7 @@ from nova import flags - FLAGS = flags.FLAGS - flags.DEFINE_string('vncproxy_topic', 'vncproxy', 'the topic vnc proxy nodes listen on') flags.DEFINE_string('vncproxy_url', diff --git a/nova/vnc/auth.py b/nova/vnc/auth.py index 86efffbe6dc8..c7df13450e32 100644 --- a/nova/vnc/auth.py +++ b/nova/vnc/auth.py @@ -44,7 +44,7 @@ class VNCNovaAuthMiddleware(object): def __init__(self, app): self.app = app self.token_cache = {} - utils.LoopingCall(self.delete_expired_tokens).start(1) + utils.LoopingCall(self.delete_expired_cache_items).start(1) @webob.dec.wsgify def __call__(self, req): @@ -78,7 +78,7 @@ class VNCNovaAuthMiddleware(object): self.token_cache[token] = rval return rval - def delete_expired_tokens(self): + def delete_expired_cache_items(self): now = time.time() to_delete = [] for k, v in self.token_cache.items(): diff --git a/nova/vnc/proxy.py b/nova/vnc/proxy.py index c6e46396b5b8..c4603803b10e 100644 --- a/nova/vnc/proxy.py +++ b/nova/vnc/proxy.py @@ -25,9 +25,9 @@ import eventlet from eventlet import wsgi from eventlet import websocket -from webob import Request import webob + WS_ENDPOINT = '/data' @@ -88,7 +88,7 @@ class WebsocketVNCProxy(object): _handle(environ, start_response) def __call__(self, environ, start_response): - req = Request(environ) + req = webob.Request(environ) if req.path == WS_ENDPOINT: return self.proxy_connection(environ, start_response) else: