summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2012-11-21 12:15:20 +0000
committerMark McLoughlin <markmc@redhat.com>2012-11-21 12:15:20 +0000
commitf324af240105ecce8b18cda97ce8a87a353bc8e5 (patch)
treea03cb8229ae172c5be1db9142d0ee8bccb3879ae
parent9dfb4b420f9d15d348f9fa9a2a0cb1a57f4e5771 (diff)
downloadnova-f324af240105ecce8b18cda97ce8a87a353bc8e5.tar.gz
nova-f324af240105ecce8b18cda97ce8a87a353bc8e5.tar.xz
nova-f324af240105ecce8b18cda97ce8a87a353bc8e5.zip
Move sql options to nova.db.sqlalchemy.session
With a few minor exceptions, the sql config options are used solely within the nova.db.sqlalchemy.session module so it makes sense to move their declaration into that module. Change-Id: Iea9c2bb000cd713b01750ab3e796132ebeaa4ca8
-rw-r--r--nova/config.py35
-rw-r--r--nova/db/sqlalchemy/api.py2
-rw-r--r--nova/db/sqlalchemy/session.py45
-rw-r--r--nova/tests/__init__.py4
-rw-r--r--nova/virt/baremetal/db/sqlalchemy/session.py3
5 files changed, 44 insertions, 45 deletions
diff --git a/nova/config.py b/nova/config.py
index 550960e53..7cf1fc30f 100644
--- a/nova/config.py
+++ b/nova/config.py
@@ -43,10 +43,6 @@ def _get_my_ip():
core_opts = [
- cfg.StrOpt('sql_connection',
- default='sqlite:///$state_path/$sqlite_db',
- help='The SQLAlchemy connection string used to connect to the '
- 'database'),
cfg.StrOpt('api_paste_config',
default="api-paste.ini",
help='File name for the paste.deploy config for nova-api'),
@@ -66,13 +62,6 @@ debug_opts = [
cfg.BoolOpt('fake_network',
default=False,
help='If passed, use fake network devices and addresses'),
- cfg.IntOpt('sql_connection_debug',
- default=0,
- help='Verbosity of SQL debugging information. 0=None, '
- '100=Everything'),
- cfg.BoolOpt('sql_connection_trace',
- default=False,
- help='Add python stack traces to SQL as comment strings'),
]
cfg.CONF.register_cli_opts(core_opts)
@@ -205,30 +194,6 @@ global_opts = [
cfg.StrOpt('vpn_key_suffix',
default='-vpn',
help='Suffix to add to project name for vpn key and secgroups'),
- cfg.StrOpt('sqlite_db',
- default='nova.sqlite',
- help='the filename to use with sqlite'),
- cfg.BoolOpt('sqlite_synchronous',
- default=True,
- help='If passed, use synchronous mode for sqlite'),
- cfg.IntOpt('sql_idle_timeout',
- default=3600,
- help='timeout before idle sql connections are reaped'),
- cfg.IntOpt('sql_max_retries',
- default=10,
- help='maximum db connection retries during startup. '
- '(setting -1 implies an infinite retry count)'),
- cfg.IntOpt('sql_retry_interval',
- default=10,
- help='interval between retries of opening a sql connection'),
- cfg.IntOpt('sql_max_pool_size',
- default=5,
- help='Maximum number of SQL connections to keep open in a '
- 'pool'),
- cfg.IntOpt('sql_max_overflow',
- default=None,
- help='If set, use this value for max_overflow with '
- 'sqlalchemy'),
cfg.StrOpt('compute_manager',
default='nova.compute.manager.ComputeManager',
help='full class name for the Manager for compute'),
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py
index acececd8d..a69e1b6c5 100644
--- a/nova/db/sqlalchemy/api.py
+++ b/nova/db/sqlalchemy/api.py
@@ -50,7 +50,7 @@ from nova.openstack.common import uuidutils
CONF = cfg.CONF
CONF.import_opt('compute_topic', 'nova.config')
-CONF.import_opt('sql_connection', 'nova.config')
+CONF.import_opt('sql_connection', 'nova.db.sqlalchemy.session')
LOG = logging.getLogger(__name__)
diff --git a/nova/db/sqlalchemy/session.py b/nova/db/sqlalchemy/session.py
index 6ff2b4e3b..24ed4f7b8 100644
--- a/nova/db/sqlalchemy/session.py
+++ b/nova/db/sqlalchemy/session.py
@@ -174,13 +174,46 @@ from nova.openstack.common import cfg
import nova.openstack.common.log as logging
+sql_opts = [
+ cfg.StrOpt('sql_connection',
+ default='sqlite:///$state_path/$sqlite_db',
+ help='The SQLAlchemy connection string used to connect to the '
+ 'database'),
+ cfg.StrOpt('sqlite_db',
+ default='nova.sqlite',
+ help='the filename to use with sqlite'),
+ cfg.IntOpt('sql_idle_timeout',
+ default=3600,
+ help='timeout before idle sql connections are reaped'),
+ cfg.BoolOpt('sqlite_synchronous',
+ default=True,
+ help='If passed, use synchronous mode for sqlite'),
+ cfg.IntOpt('sql_max_pool_size',
+ default=5,
+ help='Maximum number of SQL connections to keep open in a '
+ 'pool'),
+ cfg.IntOpt('sql_max_retries',
+ default=10,
+ help='maximum db connection retries during startup. '
+ '(setting -1 implies an infinite retry count)'),
+ cfg.IntOpt('sql_retry_interval',
+ default=10,
+ help='interval between retries of opening a sql connection'),
+ cfg.IntOpt('sql_max_overflow',
+ default=None,
+ help='If set, use this value for max_overflow with sqlalchemy'),
+ cfg.IntOpt('sql_connection_debug',
+ default=0,
+ help='Verbosity of SQL debugging information. 0=None, '
+ '100=Everything'),
+ cfg.BoolOpt('sql_connection_trace',
+ default=False,
+ help='Add python stack traces to SQL as comment strings'),
+]
+
CONF = cfg.CONF
-CONF.import_opt('sql_connection', 'nova.config')
-CONF.import_opt('sql_idle_timeout', 'nova.config')
-CONF.import_opt('sqlite_synchronous', 'nova.config')
-CONF.import_opt('sql_max_retries', 'nova.config')
-CONF.import_opt('sql_retry_interval', 'nova.config')
-CONF.import_opt('sql_max_pool_size', 'nova.config')
+CONF.register_opts(sql_opts)
+CONF.import_opt('state_path', 'nova.config')
LOG = logging.getLogger(__name__)
_ENGINE = None
diff --git a/nova/tests/__init__.py b/nova/tests/__init__.py
index d7edb7cf6..6e19e6dc2 100644
--- a/nova/tests/__init__.py
+++ b/nova/tests/__init__.py
@@ -41,8 +41,8 @@ import eventlet
eventlet.monkey_patch(os=False)
CONF = cfg.CONF
-CONF.import_opt('sql_connection', 'nova.config')
-CONF.import_opt('sqlite_db', 'nova.config')
+CONF.import_opt('sql_connection', 'nova.db.sqlalchemy.session')
+CONF.import_opt('sqlite_db', 'nova.db.sqlalchemy.session')
CONF.import_opt('state_path', 'nova.config')
CONF.set_override('use_stderr', False)
diff --git a/nova/virt/baremetal/db/sqlalchemy/session.py b/nova/virt/baremetal/db/sqlalchemy/session.py
index b500433a4..3e562e32a 100644
--- a/nova/virt/baremetal/db/sqlalchemy/session.py
+++ b/nova/virt/baremetal/db/sqlalchemy/session.py
@@ -31,7 +31,8 @@ opts = [
CONF = cfg.CONF
CONF.register_opts(opts)
-CONF.import_opt('sqlite_db', 'nova.config')
+CONF.import_opt('sqlite_db', 'nova.db.sqlalchemy.session')
+CONF.import_opt('state_path', 'nova.config')
_ENGINE = None
_MAKER = None