config options: Remove 'wsgi_' prefix from opts

Now that the WSGI opts have been added to a group, there's no longer
any reason to keep the 'wsgi_' prefix for some of these opts around.
Remove it, ensuring the old names are stored as deprecated names.

Change-Id: If39bed3ed2335b6f96455870f1a47cb868d21f39
This commit is contained in:
Stephen Finucane 2016-02-09 18:14:19 +00:00
parent 8fccb6425c
commit 235864008b
5 changed files with 24 additions and 14 deletions

View File

@ -24,6 +24,10 @@ api_paste_config_opt = cfg.StrOpt('api_paste_config',
help='File name for the paste.deploy config for nova-api',
deprecated_group='DEFAULT')
# TODO(sfinucan): It is not possible to rename this to 'log_format'
# yet, as doing so would cause a conflict if '[DEFAULT] log_format'
# were used. When 'deprecated_group' is removed after Ocata, this
# should be changed.
wsgi_log_format_opt = cfg.StrOpt('wsgi_log_format',
default='%(client_ip)s "%(request_line)s" status: %(status_code)s'
' len: %(body_length)s time: %(wall_seconds).7f',
@ -59,10 +63,11 @@ tcp_keepidle_opt = cfg.IntOpt('tcp_keepidle',
"server socket. Not supported on OS X.",
deprecated_group='DEFAULT')
wsgi_default_pool_size_opt = cfg.IntOpt('wsgi_default_pool_size',
default_pool_size_opt = cfg.IntOpt('default_pool_size',
default=1000,
help="Size of the pool of greenthreads used by wsgi",
deprecated_group='DEFAULT')
deprecated_group='DEFAULT',
deprecated_name='wsgi_default_pool_size')
max_header_line_opt = cfg.IntOpt('max_header_line',
default=16384,
@ -72,11 +77,12 @@ max_header_line_opt = cfg.IntOpt('max_header_line',
"Keystone v3 API with big service catalogs).",
deprecated_group='DEFAULT')
wsgi_keep_alive_opt = cfg.BoolOpt('wsgi_keep_alive',
keep_alive_opt = cfg.BoolOpt('keep_alive',
default=True,
help="If False, closes the client socket connection "
"explicitly.",
deprecated_group='DEFAULT')
deprecated_group='DEFAULT',
deprecated_name='wsgi_keep_alive')
client_socket_timeout_opt = cfg.IntOpt('client_socket_timeout', default=900,
help="Timeout for client connections' socket operations. "
@ -92,9 +98,9 @@ ALL_OPTS = [api_paste_config_opt,
ssl_cert_file_opt,
ssl_key_file_opt,
tcp_keepidle_opt,
wsgi_default_pool_size_opt,
default_pool_size_opt,
max_header_line_opt,
wsgi_keep_alive_opt,
keep_alive_opt,
client_socket_timeout_opt
]

View File

@ -359,7 +359,7 @@ class TestWSGIService(test.NoDBTestCase):
test_service.reset()
test_service.start()
self.assertEqual(test_service.server._pool.size,
CONF.wsgi.wsgi_default_pool_size)
CONF.wsgi.default_pool_size)
class TestLauncher(test.NoDBTestCase):

View File

@ -191,7 +191,7 @@ class TestWSGIServer(test.NoDBTestCase):
# Resetting pool size to default
server.reset()
server.start()
self.assertEqual(server._pool.size, CONF.wsgi.wsgi_default_pool_size)
self.assertEqual(server._pool.size, CONF.wsgi.default_pool_size)
def test_client_socket_timeout(self):
self.flags(client_socket_timeout=5, group='wsgi')
@ -208,18 +208,18 @@ class TestWSGIServer(test.NoDBTestCase):
kwargs['socket_timeout'])
server.stop()
def test_wsgi_keep_alive(self):
self.flags(wsgi_keep_alive=False, group='wsgi')
def test_keep_alive(self):
self.flags(keep_alive=False, group='wsgi')
# mocking eventlet spawn method to check it is called with
# configured 'wsgi_keep_alive' value.
# configured 'keep_alive' value.
with mock.patch.object(eventlet,
'spawn') as mock_spawn:
server = nova.wsgi.Server("test_app", None,
host="127.0.0.1", port=0)
server.start()
_, kwargs = mock_spawn.call_args
self.assertEqual(CONF.wsgi.wsgi_keep_alive,
self.assertEqual(CONF.wsgi.keep_alive,
kwargs['keepalive'])
server.stop()

View File

@ -49,7 +49,7 @@ LOG = logging.getLogger(__name__)
class Server(service.ServiceBase):
"""Server class to manage a WSGI server, serving a WSGI application."""
default_pool_size = CONF.wsgi.wsgi_default_pool_size
default_pool_size = CONF.wsgi.default_pool_size
def __init__(self, name, app, host='0.0.0.0', port=0, pool_size=None,
protocol=eventlet.wsgi.HttpProtocol, backlog=128,
@ -183,7 +183,7 @@ class Server(service.ServiceBase):
'log': self._logger,
'log_format': CONF.wsgi.wsgi_log_format,
'debug': False,
'keepalive': CONF.wsgi.wsgi_keep_alive,
'keepalive': CONF.wsgi.keep_alive,
'socket_timeout': self.client_socket_timeout
}

View File

@ -0,0 +1,4 @@
---
upgrade:
- The 'wsgi_default_pool_size' and 'wsgi_keep_alive' options have been
renamed to 'default_pool_size' and 'keep_alive' respectively.