diff --git a/neutron/conf/wsgi.py b/neutron/conf/wsgi.py new file mode 100644 index 00000000000..3c947ad43bb --- /dev/null +++ b/neutron/conf/wsgi.py @@ -0,0 +1,37 @@ +# Copyright 2011 OpenStack Foundation. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from oslo_config import cfg +from oslo_service import wsgi + +from neutron._i18n import _ + +socket_opts = [ + cfg.IntOpt('backlog', + default=4096, + help=_("Number of backlog requests to configure " + "the socket with")), + cfg.IntOpt('retry_until_window', + default=30, + help=_("Number of seconds to keep retrying to listen")), + cfg.BoolOpt('use_ssl', + default=False, + help=_('Enable SSL on the API server')), +] + + +def register_socket_opts(cfg=cfg.CONF): + cfg.register_opts(socket_opts) + wsgi.register_opts(cfg) diff --git a/neutron/opts.py b/neutron/opts.py index 9847072bde0..91d3fdb101c 100644 --- a/neutron/opts.py +++ b/neutron/opts.py @@ -34,6 +34,7 @@ import neutron.conf.agent.ovs_conf import neutron.conf.common import neutron.conf.quota import neutron.conf.service +import neutron.conf.wsgi import neutron.db.agents_db import neutron.db.agentschedulers_db import neutron.db.dvr_mac_db @@ -133,7 +134,7 @@ def list_opts(): itertools.chain( neutron.conf.common.core_cli_opts, neutron.conf.common.core_opts, - neutron.wsgi.socket_opts, + neutron.conf.wsgi.socket_opts, neutron.conf.service.service_opts) ), (neutron.conf.common.NOVA_CONF_SECTION, diff --git a/neutron/wsgi.py b/neutron/wsgi.py index 4040d5d0cc8..1050053fd0e 100644 --- a/neutron/wsgi.py +++ b/neutron/wsgi.py @@ -16,14 +16,13 @@ """ Utility methods for working with WSGI servers """ -from __future__ import print_function - import errno import socket import sys import time import eventlet.wsgi +from neutron.conf import wsgi as wsgi_config from neutron_lib import exceptions as exception from oslo_config import cfg import oslo_i18n @@ -46,22 +45,8 @@ from neutron import context from neutron.db import api from neutron import worker as neutron_worker -socket_opts = [ - cfg.IntOpt('backlog', - default=4096, - help=_("Number of backlog requests to configure " - "the socket with")), - cfg.IntOpt('retry_until_window', - default=30, - help=_("Number of seconds to keep retrying to listen")), - cfg.BoolOpt('use_ssl', - default=False, - help=_('Enable SSL on the API server')), -] - CONF = cfg.CONF -CONF.register_opts(socket_opts) -wsgi.register_opts(CONF) +wsgi_config.register_socket_opts() LOG = logging.getLogger(__name__)