8ec8987c31
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 |
||
---|---|---|
.. | ||
bigswitch | ||
cisco | ||
db | ||
extensions | ||
hyperv | ||
linuxbridge | ||
metaplugin | ||
nec | ||
nicira | ||
openvswitch | ||
ryu | ||
__init__.py | ||
_test_extension_portbindings.py | ||
_test_rootwrap_exec.py | ||
database_stubs.py | ||
dummy_plugin.py | ||
extension_stubs.py | ||
test_agent_config.py | ||
test_agent_linux_utils.py | ||
test_agent_netns_cleanup.py | ||
test_agent_ovs_cleanup.py | ||
test_agent_rpc.py | ||
test_api_api_common.py | ||
test_api_v2_resource.py | ||
test_api_v2.py | ||
test_attributes.py | ||
test_auth.py | ||
test_common_utils.py | ||
test_config.py | ||
test_db_migration.py | ||
test_db_plugin.py | ||
test_db_rpc_base.py | ||
test_db.py | ||
test_debug_commands.py | ||
test_dhcp_agent.py | ||
test_extension_portsecurity.py | ||
test_extension_security_group.py | ||
test_extensions.py | ||
test_iptables_firewall.py | ||
test_iptables_manager.py | ||
test_l3_agent.py | ||
test_l3_plugin.py | ||
test_linux_daemon.py | ||
test_linux_dhcp.py | ||
test_linux_external_process.py | ||
test_linux_interface.py | ||
test_linux_ip_lib.py | ||
test_loadbalancer_plugin.py | ||
test_metadata_agent.py | ||
test_metadata_namespace_proxy.py | ||
test_policy.py | ||
test_quantum_context.py | ||
test_quantum_manager.py | ||
test_quota_per_tenant_ext.py | ||
test_rootwrap.py | ||
test_security_groups_rpc.py | ||
test_servicetype.py | ||
test_setup.py | ||
test_wsgi.py | ||
testlib_api.py |