summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2022-09-09 18:27:43 +0000
committerGerrit Code Review <review@openstack.org>2022-09-09 18:27:43 +0000
commit3b34d6a93d039178aa866c17b44021d7b4272c73 (patch)
tree418bf347758f61df54d1ece1e7313eedc0066490
parentb766a69f4a0709ed245f68afe3fca7564ba8c8a4 (diff)
parent8c9ef045d1e697c3bbca5379583f7bd93651f47f (diff)
downloadoslo-db-3b34d6a93d039178aa866c17b44021d7b4272c73.tar.gz
Merge "trivial: Formatting changes for oslo_db.options"
-rw-r--r--oslo_db/options.py294
1 files changed, 182 insertions, 112 deletions
diff --git a/oslo_db/options.py b/oslo_db/options.py
index bb84e61..df07c33 100644
--- a/oslo_db/options.py
+++ b/oslo_db/options.py
@@ -14,124 +14,194 @@ from oslo_config import cfg
database_opts = [
- cfg.BoolOpt('sqlite_synchronous',
- deprecated_group='DEFAULT',
- default=True,
- help='If True, SQLite uses synchronous mode.'),
- cfg.StrOpt('backend',
- default='sqlalchemy',
- deprecated_name='db_backend',
- deprecated_group='DEFAULT',
- help='The back end to use for the database.'),
- cfg.StrOpt('connection',
- help='The SQLAlchemy connection string to use to connect to '
- 'the database.',
- secret=True,
- deprecated_opts=[cfg.DeprecatedOpt('sql_connection',
- group='DEFAULT'),
- cfg.DeprecatedOpt('sql_connection',
- group='DATABASE'),
- cfg.DeprecatedOpt('connection',
- group='sql'), ]),
- cfg.StrOpt('slave_connection',
- secret=True,
- help='The SQLAlchemy connection string to use to connect to the'
- ' slave database.'),
- cfg.StrOpt('mysql_sql_mode',
- default='TRADITIONAL',
- help='The SQL mode to be used for MySQL sessions. '
- 'This option, including the default, overrides any '
- 'server-set SQL mode. To use whatever SQL mode '
- 'is set by the server configuration, '
- 'set this to no value. Example: mysql_sql_mode='),
- cfg.BoolOpt('mysql_enable_ndb',
- default=False,
- help='If True, transparently enables support for handling '
- 'MySQL Cluster (NDB).'),
+ cfg.BoolOpt(
+ 'sqlite_synchronous',
+ deprecated_group='DEFAULT',
+ default=True,
+ help='If True, SQLite uses synchronous mode.',
+ ),
+ cfg.StrOpt(
+ 'backend',
+ default='sqlalchemy',
+ deprecated_name='db_backend',
+ deprecated_group='DEFAULT',
+ help='The back end to use for the database.',
+ ),
+ cfg.StrOpt(
+ 'connection',
+ help=(
+ 'The SQLAlchemy connection string to use to connect to '
+ 'the database.'
+ ),
+ secret=True,
+ deprecated_opts=[
+ cfg.DeprecatedOpt('sql_connection', group='DEFAULT'),
+ cfg.DeprecatedOpt('sql_connection', group='DATABASE'),
+ cfg.DeprecatedOpt('connection', group='sql'),
+ ],
+ ),
+ cfg.StrOpt(
+ 'slave_connection',
+ secret=True,
+ help=(
+ 'The SQLAlchemy connection string to use to connect to the '
+ 'slave database.'
+ ),
+ ),
+ cfg.StrOpt(
+ 'mysql_sql_mode',
+ default='TRADITIONAL',
+ help=(
+ 'The SQL mode to be used for MySQL sessions. '
+ 'This option, including the default, overrides any '
+ 'server-set SQL mode. To use whatever SQL mode '
+ 'is set by the server configuration, '
+ 'set this to no value. Example: mysql_sql_mode='
+ ),
+ ),
+ cfg.BoolOpt(
+ 'mysql_enable_ndb',
+ default=False,
+ help=(
+ 'If True, transparently enables support for handling '
+ 'MySQL Cluster (NDB).'
+ ),
+ ),
cfg.IntOpt(
'connection_recycle_time',
default=3600,
- help='Connections which have been present in the connection '
- 'pool longer than this number of seconds will be replaced '
- 'with a new one the next time they are checked out from '
- 'the pool.'),
- cfg.IntOpt('max_pool_size',
- default=5,
- help='Maximum number of SQL connections to keep open in a '
- 'pool. Setting a value of 0 indicates no limit.'),
- cfg.IntOpt('max_retries',
- default=10,
- deprecated_opts=[cfg.DeprecatedOpt('sql_max_retries',
- group='DEFAULT'),
- cfg.DeprecatedOpt('sql_max_retries',
- group='DATABASE')],
- help='Maximum number of database connection retries '
- 'during startup. Set to -1 to specify an infinite '
- 'retry count.'),
- cfg.IntOpt('retry_interval',
- default=10,
- deprecated_opts=[cfg.DeprecatedOpt('sql_retry_interval',
- group='DEFAULT'),
- cfg.DeprecatedOpt('reconnect_interval',
- group='DATABASE')],
- help='Interval between retries of opening a SQL connection.'),
- cfg.IntOpt('max_overflow',
- default=50,
- deprecated_opts=[cfg.DeprecatedOpt('sql_max_overflow',
- group='DEFAULT'),
- cfg.DeprecatedOpt('sqlalchemy_max_overflow',
- group='DATABASE')],
- help='If set, use this value for max_overflow with '
- 'SQLAlchemy.'),
- cfg.IntOpt('connection_debug',
- default=0,
- min=0, max=100,
- deprecated_opts=[cfg.DeprecatedOpt('sql_connection_debug',
- group='DEFAULT')],
- help='Verbosity of SQL debugging information: 0=None, '
- '100=Everything.'),
- cfg.BoolOpt('connection_trace',
- default=False,
- deprecated_opts=[cfg.DeprecatedOpt('sql_connection_trace',
- group='DEFAULT')],
- help='Add Python stack traces to SQL as comment strings.'),
- cfg.IntOpt('pool_timeout',
- deprecated_opts=[cfg.DeprecatedOpt('sqlalchemy_pool_timeout',
- group='DATABASE')],
- help='If set, use this value for pool_timeout with '
- 'SQLAlchemy.'),
- cfg.BoolOpt('use_db_reconnect',
- default=False,
- help='Enable the experimental use of database reconnect '
- 'on connection lost.'),
- cfg.IntOpt('db_retry_interval',
- default=1,
- help='Seconds between retries of a database transaction.'),
- cfg.BoolOpt('db_inc_retry_interval',
- default=True,
- help='If True, increases the interval between retries '
- 'of a database operation up to db_max_retry_interval.'),
- cfg.IntOpt('db_max_retry_interval',
- default=10,
- help='If db_inc_retry_interval is set, the '
- 'maximum seconds between retries of a '
- 'database operation.'),
- cfg.IntOpt('db_max_retries',
- default=20,
- help='Maximum retries in case of connection error or deadlock '
- '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&...'),
+ help=(
+ 'Connections which have been present in the connection '
+ 'pool longer than this number of seconds will be replaced '
+ 'with a new one the next time they are checked out from '
+ 'the pool.'
+ ),
+ ),
+ cfg.IntOpt(
+ 'max_pool_size',
+ default=5,
+ help=(
+ 'Maximum number of SQL connections to keep open in a pool. '
+ 'Setting a value of 0 indicates no limit.'
+ ),
+ ),
+ cfg.IntOpt(
+ 'max_retries',
+ default=10,
+ deprecated_opts=[
+ cfg.DeprecatedOpt('sql_max_retries', group='DEFAULT'),
+ cfg.DeprecatedOpt('sql_max_retries', group='DATABASE'),
+ ],
+ help=(
+ 'Maximum number of database connection retries during startup. '
+ 'Set to -1 to specify an infinite retry count.'
+ ),
+ ),
+ cfg.IntOpt(
+ 'retry_interval',
+ default=10,
+ deprecated_opts=[
+ cfg.DeprecatedOpt('sql_retry_interval', group='DEFAULT'),
+ cfg.DeprecatedOpt('reconnect_interval', group='DATABASE'),
+ ],
+ help='Interval between retries of opening a SQL connection.',
+ ),
+ cfg.IntOpt(
+ 'max_overflow',
+ default=50,
+ deprecated_opts=[
+ cfg.DeprecatedOpt('sql_max_overflow', group='DEFAULT'),
+ cfg.DeprecatedOpt('sqlalchemy_max_overflow', group='DATABASE'),
+ ],
+ help='If set, use this value for max_overflow with SQLAlchemy.',
+ ),
+ cfg.IntOpt(
+ 'connection_debug',
+ default=0,
+ min=0,
+ max=100,
+ deprecated_opts=[
+ cfg.DeprecatedOpt('sql_connection_debug', group='DEFAULT')
+ ],
+ help=(
+ 'Verbosity of SQL debugging information: 0=None, '
+ '100=Everything.'
+ ),
+ ),
+ cfg.BoolOpt(
+ 'connection_trace',
+ default=False,
+ deprecated_opts=[
+ cfg.DeprecatedOpt('sql_connection_trace', group='DEFAULT')
+ ],
+ help='Add Python stack traces to SQL as comment strings.',
+ ),
+ cfg.IntOpt(
+ 'pool_timeout',
+ deprecated_opts=[
+ cfg.DeprecatedOpt('sqlalchemy_pool_timeout', group='DATABASE')
+ ],
+ help='If set, use this value for pool_timeout with SQLAlchemy.',
+ ),
+ cfg.BoolOpt(
+ 'use_db_reconnect',
+ default=False,
+ help=(
+ 'Enable the experimental use of database reconnect '
+ 'on connection lost.'
+ ),
+ ),
+ cfg.IntOpt(
+ 'db_retry_interval',
+ default=1,
+ help='Seconds between retries of a database transaction.',
+ ),
+ cfg.BoolOpt(
+ 'db_inc_retry_interval',
+ default=True,
+ help=(
+ 'If True, increases the interval between retries '
+ 'of a database operation up to db_max_retry_interval.'
+ ),
+ ),
+ cfg.IntOpt(
+ 'db_max_retry_interval',
+ default=10,
+ help=(
+ 'If db_inc_retry_interval is set, the '
+ 'maximum seconds between retries of a '
+ 'database operation.'
+ ),
+ ),
+ cfg.IntOpt(
+ 'db_max_retries',
+ default=20,
+ help=(
+ 'Maximum retries in case of connection error or deadlock '
+ '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&...'
+ ),
+ ),
]
-def set_defaults(conf, connection=None, max_pool_size=None,
- max_overflow=None, pool_timeout=None):
+def set_defaults(
+ conf,
+ connection=None,
+ max_pool_size=None,
+ max_overflow=None,
+ pool_timeout=None,
+):
"""Set defaults for configuration variables.
Overrides default options values.