Config template string for $sqlite_db broken

Bug #1339295 reported by Cory Stone
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Medium
Cory Stone

Bug Description

It looks like config template substitution only works with options in the default group. The sqlite_db entry is now in the [database] group, so the default config value of 'sqlite:///$state_path/$sqlite_db' doesn't work.

Instead, you get this lovely stack trace:

2014-07-08 19:17:04.070 TRACE cinder Traceback (most recent call last):
2014-07-08 19:17:04.070 TRACE cinder File "/usr/local/bin/cinder-manage", line 6, in <module>
2014-07-08 19:17:04.070 TRACE cinder exec(compile(open(__file__).read(), __file__, 'exec'))
2014-07-08 19:17:04.070 TRACE cinder File "/opt/stack/cinder/bin/cinder-manage", line 561, in <module>
2014-07-08 19:17:04.070 TRACE cinder main()
2014-07-08 19:17:04.070 TRACE cinder File "/opt/stack/cinder/bin/cinder-manage", line 558, in main
2014-07-08 19:17:04.070 TRACE cinder fn(*fn_args)
2014-07-08 19:17:04.070 TRACE cinder File "/opt/stack/cinder/bin/cinder-manage", line 229, in version
2014-07-08 19:17:04.070 TRACE cinder print(migration.db_version())
2014-07-08 19:17:04.070 TRACE cinder File "/opt/stack/cinder/cinder/db/migration.py", line 33, in db_version
2014-07-08 19:17:04.070 TRACE cinder return IMPL.db_version()
2014-07-08 19:17:04.070 TRACE cinder File "/opt/stack/cinder/cinder/db/sqlalchemy/migration.py", line 51, in db_version
2014-07-08 19:17:04.070 TRACE cinder return versioning_api.db_version(get_engine(), repository)
2014-07-08 19:17:04.070 TRACE cinder File "/opt/stack/cinder/cinder/db/sqlalchemy/api.py", line 69, in get_engine
2014-07-08 19:17:04.070 TRACE cinder facade = _create_facade_lazily()
2014-07-08 19:17:04.070 TRACE cinder File "/opt/stack/cinder/cinder/db/sqlalchemy/api.py", line 62, in _create_facade_lazily
2014-07-08 19:17:04.070 TRACE cinder CONF.database.connection,
2014-07-08 19:17:04.070 TRACE cinder File "/opt/stack/oslo.config/oslo/config/cfg.py", line 2292, in __getattr__
2014-07-08 19:17:04.070 TRACE cinder return self._conf._get(name, self._group)
2014-07-08 19:17:04.070 TRACE cinder File "/opt/stack/oslo.config/oslo/config/cfg.py", line 2030, in _get
2014-07-08 19:17:04.070 TRACE cinder value = self._do_get(name, group, namespace)
2014-07-08 19:17:04.070 TRACE cinder File "/opt/stack/oslo.config/oslo/config/cfg.py", line 2066, in _do_get
2014-07-08 19:17:04.070 TRACE cinder return convert(opt._get_from_namespace(namespace, group_name))
2014-07-08 19:17:04.070 TRACE cinder File "/opt/stack/oslo.config/oslo/config/cfg.py", line 2061, in convert
2014-07-08 19:17:04.070 TRACE cinder return self._convert_value(self._substitute(value, namespace), opt)
2014-07-08 19:17:04.070 TRACE cinder File "/opt/stack/oslo.config/oslo/config/cfg.py", line 2110, in _substitute
2014-07-08 19:17:04.070 TRACE cinder self.StrSubWrapper(self, namespace=namespace))
2014-07-08 19:17:04.070 TRACE cinder File "/usr/lib/python2.7/string.py", line 205, in safe_substitute
2014-07-08 19:17:04.070 TRACE cinder return self.pattern.sub(convert, self.template)
2014-07-08 19:17:04.070 TRACE cinder File "/usr/lib/python2.7/string.py", line 190, in convert
2014-07-08 19:17:04.070 TRACE cinder return '%s' % (mapping[named],)
2014-07-08 19:17:04.070 TRACE cinder File "/opt/stack/oslo.config/oslo/config/cfg.py", line 2367, in __getitem__
2014-07-08 19:17:04.070 TRACE cinder value = self.conf._get(key, namespace=self.namespace)
2014-07-08 19:17:04.070 TRACE cinder File "/opt/stack/oslo.config/oslo/config/cfg.py", line 2030, in _get
2014-07-08 19:17:04.070 TRACE cinder value = self._do_get(name, group, namespace)
2014-07-08 19:17:04.070 TRACE cinder File "/opt/stack/oslo.config/oslo/config/cfg.py", line 2048, in _do_get
2014-07-08 19:17:04.070 TRACE cinder info = self._get_opt_info(name, group)
2014-07-08 19:17:04.070 TRACE cinder File "/opt/stack/oslo.config/oslo/config/cfg.py", line 2172, in _get_opt_info
2014-07-08 19:17:04.070 TRACE cinder raise NoSuchOptError(opt_name, group)
2014-07-08 19:17:04.070 TRACE cinder NoSuchOptError: no such option: sqlite_db

Cory Stone (corystone)
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.openstack.org/105598

Changed in cinder:
assignee: nobody → Cory Stone (corystone)
status: New → In Progress
Revision history for this message
Huang Zhiteng (zhiteng-huang) wrote :

This is due to known limitation of oslo.config doesn't support interpolation using values of options in groups: https://github.com/openstack/oslo.config/blob/master/oslo/config/cfg.py#L241

Changed in cinder:
importance: Undecided → Medium
milestone: none → juno-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/105598
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=b1315f6eee54f56e245f947574d173aea06bcaa2
Submitter: Jenkins
Branch: master

commit b1315f6eee54f56e245f947574d173aea06bcaa2
Author: Cory Stone <email address hidden>
Date: Tue Jul 8 15:01:04 2014 -0500

    Remove $sqlite_db from default database connection

    sqlite_db used to be a config option in the DEFAULT section. This
    allowed it to be used in config template substitution. Now that it is in
    the database section, the template substitution fails with a
    NoSuchOptError.

    The quick fix is to just hardcode the default connection option to refer
    directly to 'cinder.sqlite' instead.

    Closes bug: 1339295

    Change-Id: Ifd2267aaa8c55d78f88ce6648badefe3f9f664ee

Changed in cinder:
status: In Progress → Fix Committed
Changed in cinder:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in cinder:
milestone: juno-2 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.