vmware-nsx/quantum
Paul Michali 8ec8987c31 Remove cfg option default value and check if missing
Currently, several plugins already check config options at __init__()
for validity and will exit, if the settings are incorrect. However,
most (all?) config option definitions have default values, so if the
option is missing, a valid, but maybe unexpected value will be used.
This is what occurred in the bug.

The proposed fix is to take a config option, sql_connection, which is
used by many plugins, and remove the default value. Then, at init
time, when the config option is used in configure_db(), a check is
made for the value. If the value is not set, a warning is logged and
the value is set to the default, for db/api.py. It is expected that
this will be the only module to consume this config option.

Added UT to check that log warning is issued. Also, changed the timing
so that the test takes 0.25 secs vs 12 secs. Removed UTs in two plugin
tests that checked the default value for sql_connection.

Other alternatives explored in previous patches, were to either
raise an exception, or mark this config option as "required". This
resulted in a large number of changes to tests, and required config
overrides in plugins that imported quantum.db.api, but did not use
sql_connection.

In order to keep this solution (of this log-hanging fruit) fix, the
proposed, simpler change is being made.

Some cleanup to the Cisco plugin test case was also made, so that
the mock was more in line with what production code does.

bug 1059923

Change-Id: I8c2a4e05231ac4e172d0dccece067e6fdb354341
2013-02-12 09:24:22 -05:00
..
agent only destroy single namespace if router_id is set 2013-02-12 08:52:04 +01:00
api Adds API parameters to quantum.api.extension.ResourceExtension 2013-02-11 13:26:53 +09:00
common fix grammar in NetworkInUse exception 2013-02-10 16:28:19 -08:00
db Remove cfg option default value and check if missing 2013-02-12 09:24:22 -05:00
debug Define root_helper variable under the [AGENT] section 2013-02-04 09:11:47 +00:00
extensions Adds API parameters to quantum.api.extension.ResourceExtension 2013-02-11 13:26:53 +09:00
locale Imported Translations from Transifex 2013-02-12 00:03:11 +00:00
openstack Sync latest cfg from oslo-incubator 2013-02-10 07:08:24 +09:00
plugins Merge "Adds API parameters to quantum.api.extension.ResourceExtension" 2013-02-11 17:33:31 +00:00
rootwrap Remove unused imports in rootwrap package 2013-01-02 22:38:46 +02:00
server Fix i18n messages 2013-01-22 11:42:15 +08:00
tests Remove cfg option default value and check if missing 2013-02-12 09:24:22 -05:00
__init__.py Update codebase for HACKING compliance. 2012-05-01 11:46:24 -07:00
auth.py Fix i18n messages 2013-01-22 11:42:15 +08:00
context.py Fix i18n messages 2013-01-22 11:42:15 +08:00
manager.py Set default core_plugin to None 2013-01-02 16:47:54 +00:00
policy.py Use policy_file parameter in quantum.policy 2013-02-05 17:26:39 +02:00
quantum_plugin_base_v2.py fix broken logic of only using hasattr to check for get_x_counts 2012-11-20 12:59:20 -08:00
quota.py Fixes per tenant quota doesn't work 2013-01-24 17:16:52 +08:00
service.py Fix i18n messages 2013-01-22 11:42:15 +08:00
version.py Updated to latest oslo-version code. 2013-02-04 11:21:16 +11:00
wsgi.py Adds xml support for quantum v2 API. 2013-02-06 00:50:24 +00:00