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 <tomas@sedovic.cz>
This commit is contained in:
Tomas Sedovic 2012-07-18 13:34:03 +02:00
parent cf56c2613b
commit 6029c031ea
4 changed files with 14 additions and 9 deletions

View File

@ -35,7 +35,6 @@ gettext.install('heat', unicode=1)
from heat.common import config from heat.common import config
from heat.common import wsgi from heat.common import wsgi
from paste import httpserver
from heat.openstack.common import cfg from heat.openstack.common import cfg
from heat.openstack.common import log as logging from heat.openstack.common import log as logging
@ -52,7 +51,9 @@ if __name__ == '__main__':
port = cfg.CONF.bind_port port = cfg.CONF.bind_port
host = cfg.CONF.bind_host host = cfg.CONF.bind_host
LOG.info(('Starting Heat API on %s:%s') % (host, port)) LOG.info('Starting Heat API 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: except RuntimeError, e:
sys.exit("ERROR: %s" % e) sys.exit("ERROR: %s" % e)

View File

@ -37,7 +37,6 @@ from heat.openstack.common import rpc
from heat.common import config from heat.common import config
from heat.common import wsgi from heat.common import wsgi
from heat.common import context from heat.common import context
from paste import httpserver
from heat.openstack.common import log as logging from heat.openstack.common import log as logging
from heat.openstack.common import cfg from heat.openstack.common import cfg
@ -76,6 +75,8 @@ if __name__ == '__main__':
host = cfg.CONF.bind_host host = cfg.CONF.bind_host
send_address_to_engine(host, port) send_address_to_engine(host, port)
LOG.info(('Starting Heat Metadata on %s:%s') % (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: except RuntimeError, e:
sys.exit("ERROR: %s" % e) sys.exit("ERROR: %s" % e)

View File

@ -226,9 +226,6 @@ def load_paste_app(app_name=None):
raise RuntimeError("Unable to locate config file") raise RuntimeError("Unable to locate config file")
try: try:
# Setup logging early
setup_logging()
app = wsgi.paste_deploy_app(conf_file, app_name, cfg.CONF) app = wsgi.paste_deploy_app(conf_file, app_name, cfg.CONF)
# Log the options used when starting if we're in debug mode... # Log the options used when starting if we're in debug mode...

View File

@ -47,6 +47,10 @@ from heat.openstack.common import cfg
from heat.openstack.common import importutils from heat.openstack.common import importutils
from heat.openstack.common import utils 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 = [ bind_opts = [
cfg.StrOpt('bind_host', default='0.0.0.0'), cfg.StrOpt('bind_host', default='0.0.0.0'),
cfg.IntOpt('bind_port'), cfg.IntOpt('bind_port'),
@ -74,7 +78,9 @@ class WritableLogger(object):
def get_bind_addr(conf, default_port=None): def get_bind_addr(conf, default_port=None):
"""Return the host and port to bind to.""" """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) return (conf.bind_host, conf.bind_port or default_port)