Merge "Add eventlet db_pool use for mysql"
This commit is contained in:
commit
461417b640
@ -10,8 +10,18 @@ sql_connection = sqlite://
|
|||||||
# Database reconnection retry times - in event connectivity is lost
|
# Database reconnection retry times - in event connectivity is lost
|
||||||
# set to -1 implies an infinite retry count
|
# set to -1 implies an infinite retry count
|
||||||
# sql_max_retries = 10
|
# sql_max_retries = 10
|
||||||
# Database reconnection interval in seconds - in event connectivity is lost
|
# Database reconnection interval in seconds - if the initial connection to the
|
||||||
|
# database fails
|
||||||
reconnect_interval = 2
|
reconnect_interval = 2
|
||||||
|
# Enable the use of eventlet's db_pool for MySQL. The flags sql_min_pool_size,
|
||||||
|
# sql_max_pool_size and sql_idle_timeout are relevant only if this is enabled.
|
||||||
|
# sql_dbpool_enable = False
|
||||||
|
# Minimum number of SQL connections to keep open in a pool
|
||||||
|
# sql_min_pool_size = 1
|
||||||
|
# Maximum number of SQL connections to keep open in a pool
|
||||||
|
# sql_max_pool_size = 5
|
||||||
|
# Timeout in seconds before idle sql connections are reaped
|
||||||
|
# sql_idle_timeout = 3600
|
||||||
|
|
||||||
[RESTPROXY]
|
[RESTPROXY]
|
||||||
# All configuration for this plugin is in section '[restproxy]'
|
# All configuration for this plugin is in section '[restproxy]'
|
||||||
|
@ -30,8 +30,18 @@ sql_connection = sqlite://
|
|||||||
# Database reconnection retry times - in event connectivity is lost
|
# Database reconnection retry times - in event connectivity is lost
|
||||||
# set to -1 implies an infinite retry count
|
# set to -1 implies an infinite retry count
|
||||||
# sql_max_retries = 10
|
# sql_max_retries = 10
|
||||||
# Database reconnection interval in seconds - in event connectivity is lost
|
# Database reconnection interval in seconds - if the initial connection to the
|
||||||
|
# database fails
|
||||||
reconnect_interval = 2
|
reconnect_interval = 2
|
||||||
|
# Enable the use of eventlet's db_pool for MySQL. The flags sql_min_pool_size,
|
||||||
|
# sql_max_pool_size and sql_idle_timeout are relevant only if this is enabled.
|
||||||
|
# sql_dbpool_enable = False
|
||||||
|
# Minimum number of SQL connections to keep open in a pool
|
||||||
|
# sql_min_pool_size = 1
|
||||||
|
# Maximum number of SQL connections to keep open in a pool
|
||||||
|
# sql_max_pool_size = 5
|
||||||
|
# Timeout in seconds before idle sql connections are reaped
|
||||||
|
# sql_idle_timeout = 3600
|
||||||
|
|
||||||
[LINUX_BRIDGE]
|
[LINUX_BRIDGE]
|
||||||
# (ListOpt) Comma-separated list of
|
# (ListOpt) Comma-separated list of
|
||||||
|
@ -9,9 +9,20 @@ sql_connection = mysql://root:password@localhost/quantum_metaplugin?charset=utf8
|
|||||||
# Database reconnection retry times - in event connectivity is lost
|
# Database reconnection retry times - in event connectivity is lost
|
||||||
# set to -1 implgies an infinite retry count
|
# set to -1 implgies an infinite retry count
|
||||||
# sql_max_retries = 10
|
# sql_max_retries = 10
|
||||||
# Database reconnection interval in seconds - in event connectivity is lost
|
# Database reconnection interval in seconds - if the initial connection to the
|
||||||
|
# database fails
|
||||||
reconnect_interval = 2
|
reconnect_interval = 2
|
||||||
|
|
||||||
|
# Enable the use of eventlet's db_pool for MySQL. The flags sql_min_pool_size,
|
||||||
|
# sql_max_pool_size and sql_idle_timeout are relevant only if this is enabled.
|
||||||
|
# sql_dbpool_enable = False
|
||||||
|
# Minimum number of SQL connections to keep open in a pool
|
||||||
|
# sql_min_pool_size = 1
|
||||||
|
# Maximum number of SQL connections to keep open in a pool
|
||||||
|
# sql_max_pool_size = 5
|
||||||
|
# Timeout in seconds before idle sql connections are reaped
|
||||||
|
# sql_idle_timeout = 3600
|
||||||
|
|
||||||
[META]
|
[META]
|
||||||
## This is list of flavor:quantum_plugins
|
## This is list of flavor:quantum_plugins
|
||||||
# extension method is used in the order of this list
|
# extension method is used in the order of this list
|
||||||
|
@ -10,8 +10,18 @@ sql_connection = sqlite://
|
|||||||
# Database reconnection retry times - in event connectivity is lost
|
# Database reconnection retry times - in event connectivity is lost
|
||||||
# set to -1 implies an infinite retry count
|
# set to -1 implies an infinite retry count
|
||||||
# sql_max_retries = 10
|
# sql_max_retries = 10
|
||||||
# Database reconnection interval in seconds - in event connectivity is lost
|
# Database reconnection interval in seconds - if the initial connection to the
|
||||||
|
# database fails
|
||||||
reconnect_interval = 2
|
reconnect_interval = 2
|
||||||
|
# Enable the use of eventlet's db_pool for MySQL. The flags sql_min_pool_size,
|
||||||
|
# sql_max_pool_size and sql_idle_timeout are relevant only if this is enabled.
|
||||||
|
# sql_dbpool_enable = False
|
||||||
|
# Minimum number of SQL connections to keep open in a pool
|
||||||
|
# sql_min_pool_size = 1
|
||||||
|
# Maximum number of SQL connections to keep open in a pool
|
||||||
|
# sql_max_pool_size = 5
|
||||||
|
# Timeout in seconds before idle sql connections are reaped
|
||||||
|
# sql_idle_timeout = 3600
|
||||||
|
|
||||||
[OVS]
|
[OVS]
|
||||||
# Do not change this parameter unless you have a good reason to.
|
# Do not change this parameter unless you have a good reason to.
|
||||||
|
@ -10,8 +10,18 @@ sql_connection = sqlite://
|
|||||||
# Database reconnection retry times - in event connectivity is lost
|
# Database reconnection retry times - in event connectivity is lost
|
||||||
# set to -1 implies an infinite retry count
|
# set to -1 implies an infinite retry count
|
||||||
# sql_max_retries = 10
|
# sql_max_retries = 10
|
||||||
# Database reconnection interval in seconds - in event connectivity is lost
|
# Database reconnection interval in seconds - if the initial connection to the
|
||||||
|
# database fails
|
||||||
reconnect_interval = 2
|
reconnect_interval = 2
|
||||||
|
# Enable the use of eventlet's db_pool for MySQL. The flags sql_min_pool_size,
|
||||||
|
# sql_max_pool_size and sql_idle_timeout are relevant only if this is enabled.
|
||||||
|
# sql_dbpool_enable = False
|
||||||
|
# Minimum number of SQL connections to keep open in a pool
|
||||||
|
# sql_min_pool_size = 1
|
||||||
|
# Maximum number of SQL connections to keep open in a pool
|
||||||
|
# sql_max_pool_size = 5
|
||||||
|
# Timeout in seconds before idle sql connections are reaped
|
||||||
|
# sql_idle_timeout = 3600
|
||||||
|
|
||||||
[NVP]
|
[NVP]
|
||||||
# The number of logical ports to create per bridged logical switch
|
# The number of logical ports to create per bridged logical switch
|
||||||
|
@ -8,8 +8,18 @@ sql_connection = sqlite://
|
|||||||
# Database reconnection retry times - in event connectivity is lost
|
# Database reconnection retry times - in event connectivity is lost
|
||||||
# set to -1 implies an infinite retry count
|
# set to -1 implies an infinite retry count
|
||||||
# sql_max_retries = 10
|
# sql_max_retries = 10
|
||||||
# Database reconnection interval in seconds - in event connectivity is lost
|
# Database reconnection interval in seconds - if the initial connection to the
|
||||||
|
# database fails
|
||||||
reconnect_interval = 2
|
reconnect_interval = 2
|
||||||
|
# Enable the use of eventlet's db_pool for MySQL. The flags sql_min_pool_size,
|
||||||
|
# sql_max_pool_size and sql_idle_timeout are relevant only if this is enabled.
|
||||||
|
# sql_dbpool_enable = False
|
||||||
|
# Minimum number of SQL connections to keep open in a pool
|
||||||
|
# sql_min_pool_size = 1
|
||||||
|
# Maximum number of SQL connections to keep open in a pool
|
||||||
|
# sql_max_pool_size = 5
|
||||||
|
# Timeout in seconds before idle sql connections are reaped
|
||||||
|
# sql_idle_timeout = 3600
|
||||||
|
|
||||||
[OVS]
|
[OVS]
|
||||||
# (StrOpt) Type of network to allocate for tenant networks. The
|
# (StrOpt) Type of network to allocate for tenant networks. The
|
||||||
|
@ -3,6 +3,15 @@
|
|||||||
# Example: sql_connection = mysql://root:nova@127.0.0.1:3306/ryu_quantum
|
# Example: sql_connection = mysql://root:nova@127.0.0.1:3306/ryu_quantum
|
||||||
#sql_connection = mysql://<user>:<pass>@<IP>:<port>/<dbname>
|
#sql_connection = mysql://<user>:<pass>@<IP>:<port>/<dbname>
|
||||||
sql_connection = sqlite://
|
sql_connection = sqlite://
|
||||||
|
# Enable the use of eventlet's db_pool for MySQL. The flags sql_min_pool_size,
|
||||||
|
# sql_max_pool_size and sql_idle_timeout are relevant only if this is enabled.
|
||||||
|
# sql_dbpool_enable = False
|
||||||
|
# Minimum number of SQL connections to keep open in a pool
|
||||||
|
# sql_min_pool_size = 1
|
||||||
|
# Maximum number of SQL connections to keep open in a pool
|
||||||
|
# sql_max_pool_size = 5
|
||||||
|
# Timeout in seconds before idle sql connections are reaped
|
||||||
|
# sql_idle_timeout = 3600
|
||||||
|
|
||||||
[OVS]
|
[OVS]
|
||||||
integration_bridge = br-int
|
integration_bridge = br-int
|
||||||
|
@ -274,7 +274,7 @@ class Controller(object):
|
|||||||
# plugin raised might have been created or not in the db.
|
# plugin raised might have been created or not in the db.
|
||||||
# We need a way for ensuring that if it has been created,
|
# We need a way for ensuring that if it has been created,
|
||||||
# it is then deleted
|
# it is then deleted
|
||||||
raise
|
raise ex
|
||||||
|
|
||||||
def create(self, request, body=None, **kwargs):
|
def create(self, request, body=None, **kwargs):
|
||||||
"""Creates a new instance of the requested entity"""
|
"""Creates a new instance of the requested entity"""
|
||||||
|
@ -19,6 +19,12 @@
|
|||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
from eventlet import db_pool
|
||||||
|
from eventlet import greenthread
|
||||||
|
try:
|
||||||
|
import MySQLdb
|
||||||
|
except ImportError:
|
||||||
|
MySQLdb = None
|
||||||
import sqlalchemy as sql
|
import sqlalchemy as sql
|
||||||
from sqlalchemy import create_engine
|
from sqlalchemy import create_engine
|
||||||
from sqlalchemy.exc import DisconnectionError
|
from sqlalchemy.exc import DisconnectionError
|
||||||
@ -87,10 +93,31 @@ def configure_db(options):
|
|||||||
|
|
||||||
if 'mysql' in connection_dict.drivername:
|
if 'mysql' in connection_dict.drivername:
|
||||||
engine_args['listeners'] = [MySQLPingListener()]
|
engine_args['listeners'] = [MySQLPingListener()]
|
||||||
|
if (MySQLdb is not None and
|
||||||
|
options['sql_dbpool_enable']):
|
||||||
|
pool_args = {
|
||||||
|
'db': connection_dict.database,
|
||||||
|
'passwd': connection_dict.password or '',
|
||||||
|
'host': connection_dict.host,
|
||||||
|
'user': connection_dict.username,
|
||||||
|
'min_size': options['sql_min_pool_size'],
|
||||||
|
'max_size': options['sql_max_pool_size'],
|
||||||
|
'max_idle': options['sql_idle_timeout']
|
||||||
|
}
|
||||||
|
creator = db_pool.ConnectionPool(MySQLdb, **pool_args)
|
||||||
|
engine_args['creator'] = creator.create
|
||||||
|
if (MySQLdb is None and options['sql_dbpool_enable']):
|
||||||
|
LOG.warn(_("Eventlet connection pooling will not work without "
|
||||||
|
"python-mysqldb!"))
|
||||||
if 'sqlite' in connection_dict.drivername:
|
if 'sqlite' in connection_dict.drivername:
|
||||||
engine_args['listeners'] = [SqliteForeignKeysListener()]
|
engine_args['listeners'] = [SqliteForeignKeysListener()]
|
||||||
|
if options['sql_connection'] == "sqlite://":
|
||||||
|
engine_args["connect_args"] = {'check_same_thread': False}
|
||||||
|
|
||||||
_ENGINE = create_engine(options['sql_connection'], **engine_args)
|
_ENGINE = create_engine(options['sql_connection'], **engine_args)
|
||||||
|
|
||||||
|
sql.event.listen(_ENGINE, 'checkin', greenthread_yield)
|
||||||
|
|
||||||
base = options.get('base', BASE)
|
base = options.get('base', BASE)
|
||||||
if not register_models(base):
|
if not register_models(base):
|
||||||
if 'reconnect_interval' in options:
|
if 'reconnect_interval' in options:
|
||||||
@ -156,3 +183,13 @@ def unregister_models(base=BASE):
|
|||||||
global _ENGINE
|
global _ENGINE
|
||||||
assert _ENGINE
|
assert _ENGINE
|
||||||
base.metadata.drop_all(_ENGINE)
|
base.metadata.drop_all(_ENGINE)
|
||||||
|
|
||||||
|
|
||||||
|
def greenthread_yield(dbapi_con, con_record):
|
||||||
|
"""
|
||||||
|
Ensure other greenthreads get a chance to execute by forcing a context
|
||||||
|
switch. With common database backends (eg MySQLdb and sqlite), there is
|
||||||
|
no implicit yield caused by network I/O since they are implemented by
|
||||||
|
C libraries that eventlet cannot monkey patch.
|
||||||
|
"""
|
||||||
|
greenthread.sleep(0)
|
||||||
|
@ -910,11 +910,11 @@ class QuantumDbPluginV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
|||||||
obj_creator = getattr(self, 'create_%s' % resource)
|
obj_creator = getattr(self, 'create_%s' % resource)
|
||||||
objects.append(obj_creator(context, item))
|
objects.append(obj_creator(context, item))
|
||||||
context.session.commit()
|
context.session.commit()
|
||||||
except Exception:
|
except Exception as e:
|
||||||
LOG.exception(_("An exception occured while creating "
|
LOG.exception(_("An exception occured while creating "
|
||||||
"the %(resource)s:%(item)s"), locals())
|
"the %(resource)s:%(item)s"), locals())
|
||||||
context.session.rollback()
|
context.session.rollback()
|
||||||
raise
|
raise e
|
||||||
return objects
|
return objects
|
||||||
|
|
||||||
def create_network_bulk(self, context, networks):
|
def create_network_bulk(self, context, networks):
|
||||||
|
@ -70,6 +70,21 @@ database_opts = [
|
|||||||
cfg.StrOpt('sql_connection', default='sqlite://'),
|
cfg.StrOpt('sql_connection', default='sqlite://'),
|
||||||
cfg.IntOpt('sql_max_retries', default=-1),
|
cfg.IntOpt('sql_max_retries', default=-1),
|
||||||
cfg.IntOpt('reconnect_interval', default=2),
|
cfg.IntOpt('reconnect_interval', default=2),
|
||||||
|
cfg.IntOpt('sql_min_pool_size',
|
||||||
|
default=1,
|
||||||
|
help="Minimum number of SQL connections to keep open in a "
|
||||||
|
"pool"),
|
||||||
|
cfg.IntOpt('sql_max_pool_size',
|
||||||
|
default=5,
|
||||||
|
help="Maximum number of SQL connections to keep open in a "
|
||||||
|
"pool"),
|
||||||
|
cfg.IntOpt('sql_idle_timeout',
|
||||||
|
default=3600,
|
||||||
|
help="Timeout in seconds before idle sql connections are "
|
||||||
|
"reaped"),
|
||||||
|
cfg.BoolOpt('sql_dbpool_enable',
|
||||||
|
default=False,
|
||||||
|
help="Enable the use of eventlet's db_pool for MySQL"),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@ -265,7 +280,11 @@ class QuantumRestProxyV2(db_base_plugin_v2.QuantumDbPluginV2):
|
|||||||
options = {"sql_connection": "%s" % cfg.CONF.DATABASE.sql_connection,
|
options = {"sql_connection": "%s" % cfg.CONF.DATABASE.sql_connection,
|
||||||
"sql_max_retries": cfg.CONF.DATABASE.sql_max_retries,
|
"sql_max_retries": cfg.CONF.DATABASE.sql_max_retries,
|
||||||
"reconnect_interval": cfg.CONF.DATABASE.reconnect_interval,
|
"reconnect_interval": cfg.CONF.DATABASE.reconnect_interval,
|
||||||
"base": models_v2.model_base.BASEV2}
|
"base": models_v2.model_base.BASEV2,
|
||||||
|
"sql_min_pool_size": cfg.CONF.DATABASE.sql_min_pool_size,
|
||||||
|
"sql_max_pool_size": cfg.CONF.DATABASE.sql_max_pool_size,
|
||||||
|
"sql_idle_timeout": cfg.CONF.DATABASE.sql_idle_timeout,
|
||||||
|
"sql_dbpool_enable": cfg.CONF.DATABASE.sql_dbpool_enable}
|
||||||
db.configure_db(options)
|
db.configure_db(options)
|
||||||
|
|
||||||
# 'servers' is the list of network controller REST end-points
|
# 'servers' is the list of network controller REST end-points
|
||||||
|
@ -37,6 +37,21 @@ database_opts = [
|
|||||||
cfg.StrOpt('sql_connection', default='sqlite://'),
|
cfg.StrOpt('sql_connection', default='sqlite://'),
|
||||||
cfg.IntOpt('sql_max_retries', default=-1),
|
cfg.IntOpt('sql_max_retries', default=-1),
|
||||||
cfg.IntOpt('reconnect_interval', default=2),
|
cfg.IntOpt('reconnect_interval', default=2),
|
||||||
|
cfg.IntOpt('sql_min_pool_size',
|
||||||
|
default=1,
|
||||||
|
help="Minimum number of SQL connections to keep open in a "
|
||||||
|
"pool"),
|
||||||
|
cfg.IntOpt('sql_max_pool_size',
|
||||||
|
default=5,
|
||||||
|
help="Maximum number of SQL connections to keep open in a "
|
||||||
|
"pool"),
|
||||||
|
cfg.IntOpt('sql_idle_timeout',
|
||||||
|
default=3600,
|
||||||
|
help="Timeout in seconds before idle sql connections are "
|
||||||
|
"reaped"),
|
||||||
|
cfg.BoolOpt('sql_dbpool_enable',
|
||||||
|
default=False,
|
||||||
|
help="Enable the use of eventlet's db_pool for MySQL"),
|
||||||
]
|
]
|
||||||
|
|
||||||
bridge_opts = [
|
bridge_opts = [
|
||||||
|
@ -29,11 +29,16 @@ LOG = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
def initialize():
|
def initialize():
|
||||||
options = {"sql_connection": "%s" % cfg.CONF.DATABASE.sql_connection}
|
options = {
|
||||||
options.update({"sql_max_retries": cfg.CONF.DATABASE.sql_max_retries})
|
"sql_connection": cfg.CONF.DATABASE.sql_connection,
|
||||||
options.update({"reconnect_interval":
|
"sql_max_retries": cfg.CONF.DATABASE.sql_max_retries,
|
||||||
cfg.CONF.DATABASE.reconnect_interval})
|
"reconnect_interval": cfg.CONF.DATABASE.reconnect_interval,
|
||||||
options.update({"base": models_v2.model_base.BASEV2})
|
"base": models_v2.model_base.BASEV2,
|
||||||
|
"sql_min_pool_size": cfg.CONF.DATABASE.sql_min_pool_size,
|
||||||
|
"sql_max_pool_size": cfg.CONF.DATABASE.sql_max_pool_size,
|
||||||
|
"sql_idle_timeout": cfg.CONF.DATABASE.sql_idle_timeout,
|
||||||
|
"sql_dbpool_enable": cfg.CONF.DATABASE.sql_dbpool_enable
|
||||||
|
}
|
||||||
db.configure_db(options)
|
db.configure_db(options)
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,6 +22,21 @@ database_opts = [
|
|||||||
cfg.StrOpt('sql_connection', default='sqlite://'),
|
cfg.StrOpt('sql_connection', default='sqlite://'),
|
||||||
cfg.IntOpt('sql_max_retries', default=-1),
|
cfg.IntOpt('sql_max_retries', default=-1),
|
||||||
cfg.IntOpt('reconnect_interval', default=2),
|
cfg.IntOpt('reconnect_interval', default=2),
|
||||||
|
cfg.IntOpt('sql_min_pool_size',
|
||||||
|
default=1,
|
||||||
|
help="Minimum number of SQL connections to keep open in a "
|
||||||
|
"pool"),
|
||||||
|
cfg.IntOpt('sql_max_pool_size',
|
||||||
|
default=5,
|
||||||
|
help="Maximum number of SQL connections to keep open in a "
|
||||||
|
"pool"),
|
||||||
|
cfg.IntOpt('sql_idle_timeout',
|
||||||
|
default=3600,
|
||||||
|
help="Timeout in seconds before idle sql connections are "
|
||||||
|
"reaped"),
|
||||||
|
cfg.BoolOpt('sql_dbpool_enable',
|
||||||
|
default=False,
|
||||||
|
help="Enable the use of eventlet's db_pool for MySQL"),
|
||||||
]
|
]
|
||||||
|
|
||||||
meta_plugin_opts = [
|
meta_plugin_opts = [
|
||||||
|
@ -50,12 +50,16 @@ class MetaPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
|
|||||||
|
|
||||||
def __init__(self, configfile=None):
|
def __init__(self, configfile=None):
|
||||||
LOG.debug(_("Start initializing metaplugin"))
|
LOG.debug(_("Start initializing metaplugin"))
|
||||||
options = {"sql_connection": cfg.CONF.DATABASE.sql_connection}
|
options = {
|
||||||
options.update({'base': models_v2.model_base.BASEV2})
|
"sql_connection": "%s" % cfg.CONF.DATABASE.sql_connection,
|
||||||
sql_max_retries = cfg.CONF.DATABASE.sql_max_retries
|
"sql_max_retries": cfg.CONF.DATABASE.sql_max_retries,
|
||||||
options.update({"sql_max_retries": sql_max_retries})
|
"reconnect_interval": cfg.CONF.DATABASE.reconnect_interval,
|
||||||
reconnect_interval = cfg.CONF.DATABASE.reconnect_interval
|
"base": models_v2.model_base.BASEV2,
|
||||||
options.update({"reconnect_interval": reconnect_interval})
|
"sql_min_pool_size": cfg.CONF.DATABASE.sql_min_pool_size,
|
||||||
|
"sql_max_pool_size": cfg.CONF.DATABASE.sql_max_pool_size,
|
||||||
|
"sql_idle_timeout": cfg.CONF.DATABASE.sql_idle_timeout,
|
||||||
|
"sql_dbpool_enable": cfg.CONF.DATABASE.sql_dbpool_enable
|
||||||
|
}
|
||||||
self.supported_extension_aliases = \
|
self.supported_extension_aliases = \
|
||||||
cfg.CONF.META.supported_extension_aliases.split(',')
|
cfg.CONF.META.supported_extension_aliases.split(',')
|
||||||
self.supported_extension_aliases += ['flavor', 'router']
|
self.supported_extension_aliases += ['flavor', 'router']
|
||||||
|
@ -24,6 +24,21 @@ database_opts = [
|
|||||||
cfg.StrOpt('sql_connection', default='sqlite://'),
|
cfg.StrOpt('sql_connection', default='sqlite://'),
|
||||||
cfg.IntOpt('sql_max_retries', default=-1),
|
cfg.IntOpt('sql_max_retries', default=-1),
|
||||||
cfg.IntOpt('reconnect_interval', default=2),
|
cfg.IntOpt('reconnect_interval', default=2),
|
||||||
|
cfg.IntOpt('sql_min_pool_size',
|
||||||
|
default=1,
|
||||||
|
help="Minimum number of SQL connections to keep open in a "
|
||||||
|
"pool"),
|
||||||
|
cfg.IntOpt('sql_max_pool_size',
|
||||||
|
default=5,
|
||||||
|
help="Maximum number of SQL connections to keep open in a "
|
||||||
|
"pool"),
|
||||||
|
cfg.IntOpt('sql_idle_timeout',
|
||||||
|
default=3600,
|
||||||
|
help="Timeout in seconds before idle sql connections are "
|
||||||
|
"reaped"),
|
||||||
|
cfg.BoolOpt('sql_dbpool_enable',
|
||||||
|
default=False,
|
||||||
|
help="Enable the use of eventlet's db_pool for MySQL"),
|
||||||
]
|
]
|
||||||
|
|
||||||
ovs_opts = [
|
ovs_opts = [
|
||||||
|
@ -33,7 +33,11 @@ def initialize():
|
|||||||
options = {"sql_connection": "%s" % config.DATABASE.sql_connection,
|
options = {"sql_connection": "%s" % config.DATABASE.sql_connection,
|
||||||
"sql_max_retries": config.DATABASE.sql_max_retries,
|
"sql_max_retries": config.DATABASE.sql_max_retries,
|
||||||
"reconnect_interval": config.DATABASE.reconnect_interval,
|
"reconnect_interval": config.DATABASE.reconnect_interval,
|
||||||
"base": model_base.BASEV2}
|
"base": model_base.BASEV2,
|
||||||
|
"sql_min_pool_size": config.CONF.DATABASE.sql_min_pool_size,
|
||||||
|
"sql_max_pool_size": config.CONF.DATABASE.sql_max_pool_size,
|
||||||
|
"sql_idle_timeout": config.CONF.DATABASE.sql_idle_timeout,
|
||||||
|
"sql_dbpool_enable": config.CONF.DATABASE.sql_dbpool_enable}
|
||||||
db.configure_db(options)
|
db.configure_db(options)
|
||||||
|
|
||||||
|
|
||||||
@ -67,7 +71,7 @@ def add_ofc_item(model, id, quantum_id):
|
|||||||
item = model(id=id, quantum_id=quantum_id)
|
item = model(id=id, quantum_id=quantum_id)
|
||||||
session.add(item)
|
session.add(item)
|
||||||
session.flush()
|
session.flush()
|
||||||
except sa.exc.IntegrityError as exc:
|
except Exception as exc:
|
||||||
LOG.exception(exc)
|
LOG.exception(exc)
|
||||||
raise nexc.NECDBException
|
raise nexc.NECDBException
|
||||||
return item
|
return item
|
||||||
@ -103,7 +107,7 @@ def add_portinfo(id, datapath_id='', port_no=0, vlan_id=OFP_VLAN_NONE, mac=''):
|
|||||||
port_no=port_no, vlan_id=vlan_id, mac=mac)
|
port_no=port_no, vlan_id=vlan_id, mac=mac)
|
||||||
session.add(portinfo)
|
session.add(portinfo)
|
||||||
session.flush()
|
session.flush()
|
||||||
except sa.exc.IntegrityError as exc:
|
except Exception as exc:
|
||||||
LOG.exception(exc)
|
LOG.exception(exc)
|
||||||
raise nexc.NECDBException
|
raise nexc.NECDBException
|
||||||
return portinfo
|
return portinfo
|
||||||
|
@ -67,12 +67,16 @@ def parse_config():
|
|||||||
NVPCluster objects, 'plugin_config' is a dictionary with plugin
|
NVPCluster objects, 'plugin_config' is a dictionary with plugin
|
||||||
parameters (currently only 'max_lp_per_bridged_ls').
|
parameters (currently only 'max_lp_per_bridged_ls').
|
||||||
"""
|
"""
|
||||||
db_options = {"sql_connection": cfg.CONF.DATABASE.sql_connection}
|
db_options = {
|
||||||
db_options.update({'base': models_v2.model_base.BASEV2})
|
"sql_connection": "%s" % cfg.CONF.DATABASE.sql_connection,
|
||||||
sql_max_retries = cfg.CONF.DATABASE.sql_max_retries
|
"sql_max_retries": cfg.CONF.DATABASE.sql_max_retries,
|
||||||
db_options.update({"sql_max_retries": sql_max_retries})
|
"reconnect_interval": cfg.CONF.DATABASE.reconnect_interval,
|
||||||
reconnect_interval = cfg.CONF.DATABASE.reconnect_interval
|
"base": models_v2.model_base.BASEV2,
|
||||||
db_options.update({"reconnect_interval": reconnect_interval})
|
"sql_min_pool_size": cfg.CONF.DATABASE.sql_min_pool_size,
|
||||||
|
"sql_max_pool_size": cfg.CONF.DATABASE.sql_max_pool_size,
|
||||||
|
"sql_idle_timeout": cfg.CONF.DATABASE.sql_idle_timeout,
|
||||||
|
"sql_dbpool_enable": cfg.CONF.DATABASE.sql_dbpool_enable
|
||||||
|
}
|
||||||
nvp_options = {'max_lp_per_bridged_ls': cfg.CONF.NVP.max_lp_per_bridged_ls}
|
nvp_options = {'max_lp_per_bridged_ls': cfg.CONF.NVP.max_lp_per_bridged_ls}
|
||||||
nvp_options.update({'failover_time': cfg.CONF.NVP.failover_time})
|
nvp_options.update({'failover_time': cfg.CONF.NVP.failover_time})
|
||||||
nvp_options.update({'concurrent_connections':
|
nvp_options.update({'concurrent_connections':
|
||||||
|
@ -21,6 +21,21 @@ database_opts = [
|
|||||||
cfg.StrOpt('sql_connection', default='sqlite://'),
|
cfg.StrOpt('sql_connection', default='sqlite://'),
|
||||||
cfg.IntOpt('sql_max_retries', default=-1),
|
cfg.IntOpt('sql_max_retries', default=-1),
|
||||||
cfg.IntOpt('reconnect_interval', default=2),
|
cfg.IntOpt('reconnect_interval', default=2),
|
||||||
|
cfg.IntOpt('sql_min_pool_size',
|
||||||
|
default=1,
|
||||||
|
help="Minimum number of SQL connections to keep open in a "
|
||||||
|
"pool"),
|
||||||
|
cfg.IntOpt('sql_max_pool_size',
|
||||||
|
default=5,
|
||||||
|
help="Maximum number of SQL connections to keep open in a "
|
||||||
|
"pool"),
|
||||||
|
cfg.IntOpt('sql_idle_timeout',
|
||||||
|
default=3600,
|
||||||
|
help="Timeout in seconds before idle sql connections are "
|
||||||
|
"reaped"),
|
||||||
|
cfg.BoolOpt('sql_dbpool_enable',
|
||||||
|
default=False,
|
||||||
|
help="Enable the use of eventlet's db_pool for MySQL"),
|
||||||
]
|
]
|
||||||
|
|
||||||
nvp_opts = [
|
nvp_opts = [
|
||||||
|
@ -25,6 +25,21 @@ database_opts = [
|
|||||||
cfg.StrOpt('sql_connection', default='sqlite://'),
|
cfg.StrOpt('sql_connection', default='sqlite://'),
|
||||||
cfg.IntOpt('sql_max_retries', default=-1),
|
cfg.IntOpt('sql_max_retries', default=-1),
|
||||||
cfg.IntOpt('reconnect_interval', default=2),
|
cfg.IntOpt('reconnect_interval', default=2),
|
||||||
|
cfg.IntOpt('sql_min_pool_size',
|
||||||
|
default=1,
|
||||||
|
help="Minimum number of SQL connections to keep open in a "
|
||||||
|
"pool"),
|
||||||
|
cfg.IntOpt('sql_max_pool_size',
|
||||||
|
default=5,
|
||||||
|
help="Maximum number of SQL connections to keep open in a "
|
||||||
|
"pool"),
|
||||||
|
cfg.IntOpt('sql_idle_timeout',
|
||||||
|
default=3600,
|
||||||
|
help="Timeout in seconds before idle sql connections are "
|
||||||
|
"reaped"),
|
||||||
|
cfg.BoolOpt('sql_dbpool_enable',
|
||||||
|
default=False,
|
||||||
|
help="Enable the use of eventlet's db_pool for MySQL"),
|
||||||
]
|
]
|
||||||
|
|
||||||
ovs_opts = [
|
ovs_opts = [
|
||||||
|
@ -30,11 +30,16 @@ LOG = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
def initialize():
|
def initialize():
|
||||||
options = {"sql_connection": "%s" % cfg.CONF.DATABASE.sql_connection}
|
options = {
|
||||||
options.update({"sql_max_retries": cfg.CONF.DATABASE.sql_max_retries})
|
"sql_connection": cfg.CONF.DATABASE.sql_connection,
|
||||||
options.update({"reconnect_interval":
|
"sql_max_retries": cfg.CONF.DATABASE.sql_max_retries,
|
||||||
cfg.CONF.DATABASE.reconnect_interval})
|
"reconnect_interval": cfg.CONF.DATABASE.reconnect_interval,
|
||||||
options.update({"base": models_v2.model_base.BASEV2})
|
"base": models_v2.model_base.BASEV2,
|
||||||
|
"sql_min_pool_size": cfg.CONF.DATABASE.sql_min_pool_size,
|
||||||
|
"sql_max_pool_size": cfg.CONF.DATABASE.sql_max_pool_size,
|
||||||
|
"sql_idle_timeout": cfg.CONF.DATABASE.sql_idle_timeout,
|
||||||
|
"sql_dbpool_enable": cfg.CONF.DATABASE.sql_dbpool_enable
|
||||||
|
}
|
||||||
db.configure_db(options)
|
db.configure_db(options)
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,6 +21,21 @@ database_opts = [
|
|||||||
cfg.StrOpt('sql_connection', default='sqlite://'),
|
cfg.StrOpt('sql_connection', default='sqlite://'),
|
||||||
cfg.IntOpt('sql_max_retries', default=-1),
|
cfg.IntOpt('sql_max_retries', default=-1),
|
||||||
cfg.IntOpt('reconnect_interval', default=2),
|
cfg.IntOpt('reconnect_interval', default=2),
|
||||||
|
cfg.IntOpt('sql_min_pool_size',
|
||||||
|
default=1,
|
||||||
|
help="Minimum number of SQL connections to keep open in a "
|
||||||
|
"pool"),
|
||||||
|
cfg.IntOpt('sql_max_pool_size',
|
||||||
|
default=5,
|
||||||
|
help="Maximum number of SQL connections to keep open in a "
|
||||||
|
"pool"),
|
||||||
|
cfg.IntOpt('sql_idle_timeout',
|
||||||
|
default=3600,
|
||||||
|
help="Timeout in seconds before idle sql connections are "
|
||||||
|
"reaped"),
|
||||||
|
cfg.BoolOpt('sql_dbpool_enable',
|
||||||
|
default=False,
|
||||||
|
help="Enable the use of eventlet's db_pool for MySQL"),
|
||||||
]
|
]
|
||||||
|
|
||||||
ovs_opts = [
|
ovs_opts = [
|
||||||
|
@ -55,10 +55,16 @@ class RyuQuantumPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
|
|||||||
supported_extension_aliases = ["router"]
|
supported_extension_aliases = ["router"]
|
||||||
|
|
||||||
def __init__(self, configfile=None):
|
def __init__(self, configfile=None):
|
||||||
options = {"sql_connection": cfg.CONF.DATABASE.sql_connection}
|
options = {
|
||||||
options.update({'base': models_v2.model_base.BASEV2})
|
"sql_connection": "%s" % cfg.CONF.DATABASE.sql_connection,
|
||||||
reconnect_interval = cfg.CONF.DATABASE.reconnect_interval
|
"sql_max_retries": cfg.CONF.DATABASE.sql_max_retries,
|
||||||
options.update({"reconnect_interval": reconnect_interval})
|
"reconnect_interval": cfg.CONF.DATABASE.reconnect_interval,
|
||||||
|
"base": models_v2.model_base.BASEV2,
|
||||||
|
"sql_min_pool_size": cfg.CONF.DATABASE.sql_min_pool_size,
|
||||||
|
"sql_max_pool_size": cfg.CONF.DATABASE.sql_max_pool_size,
|
||||||
|
"sql_idle_timeout": cfg.CONF.DATABASE.sql_idle_timeout,
|
||||||
|
"sql_dbpool_enable": cfg.CONF.DATABASE.sql_dbpool_enable
|
||||||
|
}
|
||||||
db.configure_db(options)
|
db.configure_db(options)
|
||||||
|
|
||||||
self.tunnel_key = db_api_v2.TunnelKey(
|
self.tunnel_key = db_api_v2.TunnelKey(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user