From 9bb7ec57fb6b983fc19943556fa30715ff0750dc Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Fri, 20 Jun 2014 15:01:35 +0200 Subject: [PATCH] Remove eventlet_hub option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The option has a default value that is not portable, and therefore the test fails on OS like Darwin. There's actually no need to specify any hub – no other OpenStack projects as that option – as in theory Eventlet is smart enough to pick the best implementation available anyway. However, since Glance only works with poll or select as a hub, let's try them in that order. That avoids a user selecting things like 'epolls' and expecting Glance to work, whereas it would fail. Also remove a useless cleanup() call in the failing test as the start_servers() method already does a cleanup itself. Change-Id: Ia7765151ebb00cdf01e96cf39f3242899d358772 --- glance/common/wsgi.py | 17 ++++++++--------- .../tests/functional/v1/test_multiprocessing.py | 1 - glance/tests/unit/test_opts.py | 2 -- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/glance/common/wsgi.py b/glance/common/wsgi.py index 0fbd8a072c..e81ce50608 100644 --- a/glance/common/wsgi.py +++ b/glance/common/wsgi.py @@ -79,11 +79,6 @@ eventlet_opts = [ help=_('The number of child process workers that will be ' 'created to service requests. The default will be ' 'equal to the number of CPUs available.')), - cfg.StrOpt('eventlet_hub', default='poll', - help=_('Name of eventlet hub to use. Traditionally, we have ' - 'only supported \'poll\', however \'selects\' may be ' - 'appropriate for some platforms. See ' - 'http://eventlet.net/doc/hubs.html for more details.')), cfg.IntOpt('max_header_line', default=16384, help=_('Maximum line size of message headers to be accepted. ' 'max_header_line may need to be increased when using ' @@ -197,11 +192,15 @@ def get_socket(default_port): def set_eventlet_hub(): try: - eventlet.hubs.use_hub(cfg.CONF.eventlet_hub) + eventlet.hubs.use_hub('poll') except Exception: - msg = _("eventlet '%s' hub is not available on this platform") - raise exception.WorkerCreationFailure( - reason=msg % cfg.CONF.eventlet_hub) + try: + eventlet.hubs.use_hub('selects') + except Exception: + msg = _("eventlet 'poll' nor 'selects' hubs are available " + "on this platform") + raise exception.WorkerCreationFailure( + reason=msg) class Server(object): diff --git a/glance/tests/functional/v1/test_multiprocessing.py b/glance/tests/functional/v1/test_multiprocessing.py index b4c5682430..bfbb88b6aa 100644 --- a/glance/tests/functional/v1/test_multiprocessing.py +++ b/glance/tests/functional/v1/test_multiprocessing.py @@ -54,7 +54,6 @@ class TestMultiprocessing(functional.FunctionalTest): Ensure an interrupt signal does not cause a respawn storm. See bug #978130 """ - self.cleanup() self.start_servers(**self.__dict__.copy()) children = self._get_children() diff --git a/glance/tests/unit/test_opts.py b/glance/tests/unit/test_opts.py index fbe46aac3b..969e1788ad 100644 --- a/glance/tests/unit/test_opts.py +++ b/glance/tests/unit/test_opts.py @@ -102,7 +102,6 @@ class OptsTestCase(utils.BaseTestCase): 'bind_host', 'bind_port', 'workers', - 'eventlet_hub', 'max_header_line', 'backlog', 'tcp_keepidle', @@ -202,7 +201,6 @@ class OptsTestCase(utils.BaseTestCase): 'cert_file', 'key_file', 'workers', - 'eventlet_hub', 'max_header_line', 'flavor', 'config_file'