From 27d18ac5c5205604243ef50305e1ba40979551ca Mon Sep 17 00:00:00 2001 From: Joe Talerico Date: Wed, 12 Apr 2017 20:14:59 -0400 Subject: [PATCH] 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 Change-Id: Ia97d6cf24e554f7b3878dd301ae4e7e10a1c9998 Closes-Bug: #1682307 --- neutron/common/config.py | 12 ------------ neutron/tests/base.py | 7 ++++--- .../change-oslo-db-defaults-f94df09c30767f95.yaml | 10 ++++++++++ 3 files changed, 14 insertions(+), 15 deletions(-) create mode 100644 releasenotes/notes/change-oslo-db-defaults-f94df09c30767f95.yaml diff --git a/neutron/common/config.py b/neutron/common/config.py index 92b22be4a83..70c2dd7cf18 100644 --- a/neutron/common/config.py +++ b/neutron/common/config.py @@ -22,7 +22,6 @@ import sys from keystoneauth1 import loading as ks_loading from neutron_lib.api import validators from oslo_config import cfg -from oslo_db import options as db_options from oslo_log import log as logging import oslo_messaging from oslo_middleware import cors @@ -52,17 +51,6 @@ common_config.register_core_common_config_opts() 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' ks_loading.register_auth_conf_options(cfg.CONF, NOVA_CONF_SECTION) diff --git a/neutron/tests/base.py b/neutron/tests/base.py index 5a70b9896e1..e01ea5a692c 100644 --- a/neutron/tests/base.py +++ b/neutron/tests/base.py @@ -31,6 +31,7 @@ import mock from neutron_lib import fixture from oslo_concurrency.fixture import lockutils from oslo_config import cfg +from oslo_db import options as db_options from oslo_messaging import conffixture as messaging_conffixture from oslo_utils import excutils from oslo_utils import fileutils @@ -147,9 +148,9 @@ class DietTestCase(base.BaseTestCase): super(DietTestCase, self).setUp() # FIXME(amuller): this must be called in the Neutron unit tests base - # class to initialize the DB connection string. Moving this may cause - # non-deterministic failures. Bug #1489098 for more info. - config.set_db_defaults() + # class. Moving this may cause non-deterministic failures. Bug #1489098 + # for more info. + db_options.set_defaults(cfg.CONF, connection='sqlite://') # Configure this first to ensure pm debugging support for setUp() debugger = os.environ.get('OS_POST_MORTEM_DEBUGGER') diff --git a/releasenotes/notes/change-oslo-db-defaults-f94df09c30767f95.yaml b/releasenotes/notes/change-oslo-db-defaults-f94df09c30767f95.yaml new file mode 100644 index 00000000000..bdc25243760 --- /dev/null +++ b/releasenotes/notes/change-oslo-db-defaults-f94df09c30767f95.yaml @@ -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.