summaryrefslogtreecommitdiff
path: root/oslo_db/options.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2018-01-29 17:22:30 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2018-01-30 09:08:48 -0500
commit9993efdeef4606f78182d084e4120a158a4e64b8 (patch)
tree1de4d8a89442aff58b2d23e25857ef8961ed8d2e /oslo_db/options.py
parent650779240e69d36b0f95969fd689bfa52dd80c73 (diff)
downloadoslo-db-9993efdeef4606f78182d084e4120a158a4e64b8.tar.gz
Allow connection query string to be passed separately.
The Nova project has made the decision to store the entire contents of the "sql_connection" field in the database, with alterations to the host value, such that various "cells" database URLs can be located using Nova's database itself as a central registry of database URLs. This architecture has produced several problems. The first is that it is impossible to apply parameters to the URL that are local to the client machine; the leading example of this is the MySQL "bind_host" variable, which must match the hostname of the connecting host. Because cells puts these URLs into the database and shares them with all controllers, we have to use a workaround with the read_default_file parameter to specify a controller-local file of options; this is not a standard thing for other database drivers, and these parameters only apply to the MySQL driver and not the SQLAlchemy engine. The next issue is that it is inconvenient to add parameters to the URL at all, once Nova has already been running, as one must manually use Nova's command line tools to alter all the URLs that have already been copied into the database and alter the query parameters with each of those individually, and then restart *all* services who will all receive the parameter (no way to add params to just one controller). Nova's "store the URL in the database" feature only needs to be able to locate the host / database name of the alternate database, and not change the URL tuning parameters. This patch adds a new oslo.db parameter connection_parameters which allows the params to be applied separately from the sql_connection parameter, so that Nova can continue persisting sql_connection but the parameters remain local to the nova.conf file. A URL parameter that truly had to remain persisted in Nova's database (there aren't any) could still be applied at the sql_connection level. This feature is essential not just so that we can again place simple parameters into controller-local files like "bind_host", but also to allow for configuration of SQLAlchemy features such as plugins that do connection pool monitoring. Change-Id: Id4de4b09ec4719cbf8b372629fcf58cf368a33d4
Diffstat (limited to 'oslo_db/options.py')
-rw-r--r--oslo_db/options.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/oslo_db/options.py b/oslo_db/options.py
index 8bd70a2..9a08552 100644
--- a/oslo_db/options.py
+++ b/oslo_db/options.py
@@ -146,6 +146,11 @@ database_opts = [
'error before error is '
'raised. Set to -1 to specify an infinite retry '
'count.'),
+ cfg.StrOpt('connection_parameters',
+ default='',
+ help='Optional URL parameters to append onto the connection '
+ 'URL at connect time; specify as '
+ 'param1=value1&param2=value2&...'),
]