]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Use eventlet's wsgi again
authorTomas Sedovic <tomas@sedovic.cz>
Wed, 18 Jul 2012 11:34:03 +0000 (13:34 +0200)
committerTomas Sedovic <tomas@sedovic.cz>
Wed, 18 Jul 2012 11:34:35 +0000 (13:34 +0200)
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>
bin/heat-api
bin/heat-metadata
heat/common/config.py
heat/common/wsgi.py

index e252e6042c02bb17011ec229902f96af922ad6e6..5082ec00126d45a3bfafe65c40ea45167f63c4ef 100755 (executable)
@@ -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)
index 2a927e230c37f9dfd27658c6dfcd3ee3a5de1045..6c6fe4d6e9872ba42e7c72f2f2a0db4564e3957f 100755 (executable)
@@ -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)
index c5c5a0a6ca45728aa89d54986904c27daf025098..081cf180179aff48ad93480ab8ec402fc89af219 100644 (file)
@@ -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...
index 0118f14f06492a8cd65fe7d5a8748bbfc3c0155d..ecf0ae75d39a32dc99fe01005f24023a3f249a97 100644 (file)
@@ -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)