Added generic SQLOPTS
Change-Id: I74efa2e25ef5c2b202b4404721d9f6d39550955a
This commit is contained in:
parent
eff4753822
commit
b8b24209a9
@ -25,7 +25,7 @@ from moniker.central import api as central_api
|
||||
from moniker.context import MonikerContext
|
||||
from sqlalchemy.ext.sqlsoup import SqlSoup
|
||||
from sqlalchemy.engine.url import _parse_rfc1738_args
|
||||
from moniker.sqlalchemy.session import get_engine
|
||||
from moniker.sqlalchemy.session import get_engine, SQLOPTS
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -45,14 +45,13 @@ cfg.CONF.register_opts([
|
||||
help='slave or master DNS server?'),
|
||||
cfg.BoolOpt('write-database', default=True,
|
||||
help='Write to the DNS mysqlbind database?'),
|
||||
cfg.StrOpt('database-connection',
|
||||
default='mysql://dns:dns@localhost/dns',
|
||||
help='SQL Connection'),
|
||||
cfg.StrOpt('database-dns-table',
|
||||
default='dns_domains',
|
||||
help='DNS schema'),
|
||||
], group='backend:mysqlbind9')
|
||||
|
||||
cfg.CONF.register_opts(SQLOPTS, group='backend:mysqlbind9')
|
||||
|
||||
|
||||
class MySQLBind9Backend(base.Backend):
|
||||
__plugin_name__ = 'mysqlbind9'
|
||||
|
@ -34,6 +34,27 @@ _MAKERS = {}
|
||||
_ENGINES = {}
|
||||
|
||||
|
||||
SQLOPTS = [
|
||||
cfg.StrOpt('database_connection',
|
||||
default='sqlite:///$state_path/moniker.sqlite',
|
||||
help='The database driver to use'),
|
||||
cfg.IntOpt('connection_debug', default=0,
|
||||
help='Verbosity of SQL debugging information. 0=None,'
|
||||
' 100=Everything'),
|
||||
cfg.BoolOpt('connection_trace', default=False,
|
||||
help='Add python stack traces to SQL as comment strings'),
|
||||
cfg.BoolOpt('sqlite_synchronous', default=True,
|
||||
help='If passed, use synchronous mode for sqlite'),
|
||||
cfg.IntOpt('idle_timeout', default=3600,
|
||||
help='timeout before idle sql connections are reaped'),
|
||||
cfg.IntOpt('max_retries', default=10,
|
||||
help='maximum db connection retries during startup. '
|
||||
'(setting -1 implies an infinite retry count)'),
|
||||
cfg.IntOpt('retry_interval', default=10,
|
||||
help='interval between retries of opening a sql connection')
|
||||
]
|
||||
|
||||
|
||||
def get_session(config_group,
|
||||
autocommit=True,
|
||||
expire_on_commit=False,
|
||||
|
@ -19,7 +19,7 @@ from moniker.openstack.common import log as logging
|
||||
from moniker import exceptions
|
||||
from moniker.storage import base
|
||||
from moniker.storage.impl_sqlalchemy import models
|
||||
from moniker.sqlalchemy.session import get_session
|
||||
from moniker.sqlalchemy.session import get_session, SQLOPTS
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -27,25 +27,7 @@ cfg.CONF.register_group(cfg.OptGroup(
|
||||
name='storage:sqlalchemy', title="Configuration for SQLAlchemy Storage"
|
||||
))
|
||||
|
||||
cfg.CONF.register_opts([
|
||||
cfg.StrOpt('database_connection',
|
||||
default='sqlite:///$state_path/moniker.sqlite',
|
||||
help='The database driver to use'),
|
||||
cfg.IntOpt('connection_debug', default=0,
|
||||
help='Verbosity of SQL debugging information. 0=None,'
|
||||
' 100=Everything'),
|
||||
cfg.BoolOpt('connection_trace', default=False,
|
||||
help='Add python stack traces to SQL as comment strings'),
|
||||
cfg.BoolOpt('sqlite_synchronous', default=True,
|
||||
help='If passed, use synchronous mode for sqlite'),
|
||||
cfg.IntOpt('idle_timeout', default=3600,
|
||||
help='timeout before idle sql connections are reaped'),
|
||||
cfg.IntOpt('max_retries', default=10,
|
||||
help='maximum db connection retries during startup. '
|
||||
'(setting -1 implies an infinite retry count)'),
|
||||
cfg.IntOpt('retry_interval', default=10,
|
||||
help='interval between retries of opening a sql connection')
|
||||
], group='storage:sqlalchemy')
|
||||
cfg.CONF.register_opts(SQLOPTS, group='storage:sqlalchemy')
|
||||
|
||||
|
||||
class SQLAlchemyStorage(base.StorageEngine):
|
||||
|
Loading…
Reference in New Issue
Block a user