Refactoring config options for wsgi opts

Refactoring neutron wsgi config opts to be in neutron/conf so that all
the configuration options for wsgi reside in a centralized location.
This simplifies the process of looking up the wsgi config opts and
provides an easy way to import.

Change-Id: I6cf2617acd3932c60618821b6fb453c7a16e20cc
This commit is contained in:
Anindita Das 2016-08-01 19:07:45 +00:00
parent 1a8277a14c
commit b730218d58
3 changed files with 41 additions and 18 deletions

37
neutron/conf/wsgi.py Normal file
View File

@ -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)

View File

@ -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,

View File

@ -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__)