Don't override default values for oslo.db options

This change will make neutron-server use default values from oslo.db if
any of them are not overridden in config files, instead of applying its
own unique values that may be unexpected to users and operators.

It also makes our config files correct since now we don't claim wrong
values being default. (Remember the config generator was never aware of
our snowflake behaviour.)

If you wonder why we were overriding it in the first place, it was
needed back in the times when we were using db module from
oslo-incubator that has not provided proper defaults. Those times are
long gone.

Of course the change is not impact free, and operators who for some
reason want to keep the old values may need to adjust their
configuration files. Still, I believe using default values from oslo.db
is the correct thing to do long term.

We still need to set connection string for unit tests to sqlite:// since
oslo.db doesn't provide any default value for the option. It should be
fine to effectively unset default value for the option for
neutron-server since no one in production can use sqlite anyway.

This change also drops set_db_defaults function from
neutron.common.config. I have checked that there are no consumers for
the function outside the tree.

NeutronLibImpact
UpgradeImpact

Co-Authored-By: Ihar Hrachyshka <ihrachys@redhat.com>
Change-Id: Ia97d6cf24e554f7b3878dd301ae4e7e10a1c9998
Closes-Bug: #1682307
This commit is contained in:
Joe Talerico 2017-04-12 20:14:59 -04:00 committed by Ihar Hrachyshka
parent 03af8472e6
commit 27d18ac5c5
3 changed files with 14 additions and 15 deletions

View File

@ -22,7 +22,6 @@ import sys
from keystoneauth1 import loading as ks_loading from keystoneauth1 import loading as ks_loading
from neutron_lib.api import validators from neutron_lib.api import validators
from oslo_config import cfg from oslo_config import cfg
from oslo_db import options as db_options
from oslo_log import log as logging from oslo_log import log as logging
import oslo_messaging import oslo_messaging
from oslo_middleware import cors from oslo_middleware import cors
@ -52,17 +51,6 @@ common_config.register_core_common_config_opts()
oslo_messaging.set_transport_defaults(control_exchange='neutron') oslo_messaging.set_transport_defaults(control_exchange='neutron')
def set_db_defaults():
# Update the default QueuePool parameters. These can be tweaked by the
# conf variables - max_pool_size, max_overflow and pool_timeout
db_options.set_defaults(
cfg.CONF,
connection='sqlite://',
max_pool_size=10,
max_overflow=20, pool_timeout=10)
set_db_defaults()
NOVA_CONF_SECTION = 'nova' NOVA_CONF_SECTION = 'nova'
ks_loading.register_auth_conf_options(cfg.CONF, NOVA_CONF_SECTION) ks_loading.register_auth_conf_options(cfg.CONF, NOVA_CONF_SECTION)

View File

@ -31,6 +31,7 @@ import mock
from neutron_lib import fixture from neutron_lib import fixture
from oslo_concurrency.fixture import lockutils from oslo_concurrency.fixture import lockutils
from oslo_config import cfg from oslo_config import cfg
from oslo_db import options as db_options
from oslo_messaging import conffixture as messaging_conffixture from oslo_messaging import conffixture as messaging_conffixture
from oslo_utils import excutils from oslo_utils import excutils
from oslo_utils import fileutils from oslo_utils import fileutils
@ -147,9 +148,9 @@ class DietTestCase(base.BaseTestCase):
super(DietTestCase, self).setUp() super(DietTestCase, self).setUp()
# FIXME(amuller): this must be called in the Neutron unit tests base # FIXME(amuller): this must be called in the Neutron unit tests base
# class to initialize the DB connection string. Moving this may cause # class. Moving this may cause non-deterministic failures. Bug #1489098
# non-deterministic failures. Bug #1489098 for more info. # for more info.
config.set_db_defaults() db_options.set_defaults(cfg.CONF, connection='sqlite://')
# Configure this first to ensure pm debugging support for setUp() # Configure this first to ensure pm debugging support for setUp()
debugger = os.environ.get('OS_POST_MORTEM_DEBUGGER') debugger = os.environ.get('OS_POST_MORTEM_DEBUGGER')

View File

@ -0,0 +1,10 @@
---
upgrade:
- |
Previously, ``neutron-server`` was using configuration values
for ``oslo.db`` that were different from library defaults. Specifically, it
used the following values when they were not overridden in configuration
files: ``max_pool_size`` = 10, ``max_overflow`` = 20, ``pool_timeout`` =
10. In this release, ``neutron-server`` instead relies on default values
defined by the library itself. If you rely on old default values, you may
need to adjust your configuration files to explicitly set the new values.