def get_wsgi_server(): LOG.audit(_("Starting engine-vncproxy node (version %s)"), version.version_string_with_vcs()) 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)"), FLAGS.vncproxy_wwwroot) LOG.info(_("You need a slightly modified version of noVNC " "to work with the engine-vnc-proxy")) LOG.info(_("Check out the most recent engine noVNC code: %s"), "git://github.com/sleepsonthefloor/noVNC.git") LOG.info(_("And drop it in %s"), FLAGS.vncproxy_wwwroot) sys.exit(1) app = proxy.WebsocketVNCProxy(FLAGS.vncproxy_wwwroot) LOG.audit(_("Allowing access to the following files: %s"), app.get_whitelist()) with_logging = auth.LoggingMiddleware(app) if FLAGS.vnc_debug: with_auth = proxy.DebugMiddleware(with_logging) else: with_auth = auth.VNCEngineAuthMiddleware(with_logging) wsgi_server = wsgi.Server("VNC Proxy", with_auth, host=FLAGS.vncproxy_host, port=FLAGS.vncproxy_port) wsgi_server.start_tcp(handle_flash_socket_policy, host=FLAGS.vncproxy_flash_socket_policy_host, port=FLAGS.vncproxy_flash_socket_policy_port) return wsgi_server
def _log(self, level, msg, args, exc_info=None, extra=None, context=None): """Extract context from any log call.""" if not extra: extra = {} if context is None: context = getattr(local.store, 'context', None) if context: extra.update(_dictify_context(context)) extra.update({"engine_version": version.version_string_with_vcs()}) return logging.Logger._log(self, level, msg, args, exc_info, extra)
def start(self): vcs_string = version.version_string_with_vcs() logging.audit(_('Starting %(topic)s node (version %(vcs_string)s)'), {'topic': self.topic, 'vcs_string': vcs_string}) self.manager.init_host() self.model_disconnected = False ctxt = context.get_admin_context() try: service_ref = db.service_get_by_args(ctxt, self.host, self.binary) self.service_id = service_ref['id'] except exception.NotFound: self._create_service_ref(ctxt) if 'engine-compute' == self.binary: self.manager.update_available_resource(ctxt) self.conn = rpc.create_connection(new=True) logging.debug("Creating Consumer connection for Service %s" % self.topic) # Share this same connection for these Consumers self.conn.create_consumer(self.topic, self, fanout=False) node_topic = '%s.%s' % (self.topic, self.host) self.conn.create_consumer(node_topic, self, fanout=False) self.conn.create_consumer(self.topic, self, fanout=True) # Consume from all consumers in a thread self.conn.consume_in_thread() if self.report_interval: pulse = utils.LoopingCall(self.report_state) pulse.start(interval=self.report_interval, now=False) self.timers.append(pulse) if self.periodic_interval: periodic = utils.LoopingCall(self.periodic_tasks) periodic.start(interval=self.periodic_interval, now=False) self.timers.append(periodic)
def get_wsgi_server(): LOG.audit(_("Starting engine-vncproxy node (version %s)"), version.version_string_with_vcs()) 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)"), FLAGS.vncproxy_wwwroot) LOG.info( _("You need a slightly modified version of noVNC " "to work with the engine-vnc-proxy")) LOG.info(_("Check out the most recent engine noVNC code: %s"), "git://github.com/sleepsonthefloor/noVNC.git") LOG.info(_("And drop it in %s"), FLAGS.vncproxy_wwwroot) sys.exit(1) app = proxy.WebsocketVNCProxy(FLAGS.vncproxy_wwwroot) LOG.audit(_("Allowing access to the following files: %s"), app.get_whitelist()) with_logging = auth.LoggingMiddleware(app) if FLAGS.vnc_debug: with_auth = proxy.DebugMiddleware(with_logging) else: with_auth = auth.VNCEngineAuthMiddleware(with_logging) wsgi_server = wsgi.Server("VNC Proxy", with_auth, host=FLAGS.vncproxy_host, port=FLAGS.vncproxy_port) wsgi_server.start_tcp(handle_flash_socket_policy, host=FLAGS.vncproxy_flash_socket_policy_host, port=FLAGS.vncproxy_flash_socket_policy_port) return wsgi_server