From: Tomas Sedovic Date: Wed, 18 Jul 2012 11:34:03 +0000 (+0200) Subject: Use eventlet's wsgi again X-Git-Tag: 2014.1~1583 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=6029c031eac1ca8cdf833300d79de49717ecb137;p=openstack-build%2Fheat-build.git Use eventlet's wsgi again Ref #55 This adds a monkey patch for the eventlet's maximum url length issue (ref #18). With it, we can use eventlet as our wsgi server again. Once Eventlet releases a new version (the fix is already in master) we'll drop the monkey patch and set the limit proper. Change-Id: Ia122af8d53b49587ade0ead6897fdd10107f4a87 Signed-off-by: Tomas Sedovic --- diff --git a/bin/heat-api b/bin/heat-api index e252e604..5082ec00 100755 --- a/bin/heat-api +++ b/bin/heat-api @@ -35,7 +35,6 @@ gettext.install('heat', unicode=1) from heat.common import config from heat.common import wsgi -from paste import httpserver from heat.openstack.common import cfg from heat.openstack.common import log as logging @@ -52,7 +51,9 @@ if __name__ == '__main__': port = cfg.CONF.bind_port host = cfg.CONF.bind_host - LOG.info(('Starting Heat API on %s:%s') % (host, port)) - httpserver.serve(app, host=host, port=port) + LOG.info('Starting Heat API on %s:%s' % (host, port)) + server = wsgi.Server() + server.start(app, cfg.CONF, default_port=port) + server.wait() except RuntimeError, e: sys.exit("ERROR: %s" % e) diff --git a/bin/heat-metadata b/bin/heat-metadata index 2a927e23..6c6fe4d6 100755 --- a/bin/heat-metadata +++ b/bin/heat-metadata @@ -37,7 +37,6 @@ from heat.openstack.common import rpc from heat.common import config from heat.common import wsgi from heat.common import context -from paste import httpserver from heat.openstack.common import log as logging from heat.openstack.common import cfg @@ -76,6 +75,8 @@ if __name__ == '__main__': host = cfg.CONF.bind_host send_address_to_engine(host, port) LOG.info(('Starting Heat Metadata on %s:%s') % (host, port)) - httpserver.serve(app, host=host, port=port) + server = wsgi.Server() + server.start(app, cfg.CONF, default_port=port) + server.wait() except RuntimeError, e: sys.exit("ERROR: %s" % e) diff --git a/heat/common/config.py b/heat/common/config.py index c5c5a0a6..081cf180 100644 --- a/heat/common/config.py +++ b/heat/common/config.py @@ -226,9 +226,6 @@ def load_paste_app(app_name=None): raise RuntimeError("Unable to locate config file") try: - # Setup logging early - setup_logging() - app = wsgi.paste_deploy_app(conf_file, app_name, cfg.CONF) # Log the options used when starting if we're in debug mode... diff --git a/heat/common/wsgi.py b/heat/common/wsgi.py index 0118f14f..ecf0ae75 100644 --- a/heat/common/wsgi.py +++ b/heat/common/wsgi.py @@ -47,6 +47,10 @@ from heat.openstack.common import cfg from heat.openstack.common import importutils from heat.openstack.common import utils + +# TODO(shadower) remove this once eventlet with fix from #55 gets released +eventlet.wsgi.MAX_REQUEST_LINE = 50000 + bind_opts = [ cfg.StrOpt('bind_host', default='0.0.0.0'), cfg.IntOpt('bind_port'), @@ -74,7 +78,9 @@ class WritableLogger(object): def get_bind_addr(conf, default_port=None): """Return the host and port to bind to.""" - conf.register_opts(bind_opts) + for opt in bind_opts: + if not opt.name in conf: + conf.register_opt(opt) return (conf.bind_host, conf.bind_port or default_port)