OSLO DB configurations not backward compatible with old quantum configs

Bug #1193557 reported by Gary Kotton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo-incubator
Fix Released
High
Gary Kotton

Bug Description

If a uer has a configuration files that has:

[DATABASE]
sql_connection=the_actual connection

Then this does not work.

Please see and example below:
DBAPITestCase
    test_dbapi_api_class_method_and_tpool_false OK 0.00
    test_dbapi_api_class_method_and_tpool_true OK 0.34
    test_dbapi_full_path_module_method OK 0.00
    test_dbapi_parameters OK 0.00
    test_dbapi_unknown_invalid_backend OK 0.00
    test_dbapi_upper_case_deprecated_parameters ERROR 0.00
    test_deprecated_dbapi_parameters OK 0.00

======================================================================
ERROR: tests.unit.db.test_api.DBAPITestCase.test_dbapi_upper_case_deprecated_parameters
----------------------------------------------------------------------
_StringException: Empty attachments:
  pythonlogging:'openstack.common'

Traceback (most recent call last):
  File "/home/garyk/oslo-incubator/tests/unit/db/test_api.py", line 65, in test_dbapi_upper_case_deprecated_parameters
    self.assertEquals(test_utils.CONF.database.connection,
  File "/home/garyk/oslo-incubator/.tox/py27/local/lib/python2.7/site-packages/oslo/config/cfg.py", line 1808, in __getattr__
    return self._conf._get(name, self._group)
  File "/home/garyk/oslo-incubator/.tox/py27/local/lib/python2.7/site-packages/oslo/config/cfg.py", line 1613, in _get
    value = self._substitute(self._do_get(name, group))
  File "/home/garyk/oslo-incubator/.tox/py27/local/lib/python2.7/site-packages/oslo/config/cfg.py", line 1629, in _do_get
    info = self._get_opt_info(name, group)
  File "/home/garyk/oslo-incubator/.tox/py27/local/lib/python2.7/site-packages/oslo/config/cfg.py", line 1729, in _get_opt_info
    raise NoSuchOptError(opt_name, group)
NoSuchOptError: no such option in group database: connection

This is when adding the following code to OSLO:
diff --git a/requirements.txt b/requirements.txt
index 067af58..d7a33c6 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -12,6 +12,6 @@ kombu==1.0.4
 argparse
 stevedore
 SQLAlchemy>=0.7.8,<=0.7.9
-oslo.config>=1.1.0
+http://tarballs.openstack.org/oslo.config/oslo.config-1.2.0a2.tar.gz#egg=oslo.config-1.2.0a2
 qpid-python
 six
diff --git a/tests/unit/db/test_api.py b/tests/unit/db/test_api.py
index f6e0d4c..12ad847 100644
--- a/tests/unit/db/test_api.py
+++ b/tests/unit/db/test_api.py
@@ -55,6 +55,16 @@ class DBAPITestCase(test_utils.BaseTestCase):
         self.assertEquals(test_utils.CONF.database.backend, 'test_123')
         self.assertEquals(test_utils.CONF.database.use_tpool, True)

+ def test_dbapi_upper_case_deprecated_parameters(self):
+ paths = self.create_tempfiles([('test',
+ '[DATABASE]\n'
+ 'sql_connection=fake_connection\n'
+ )])
+
+ test_utils.CONF(['--config-file', paths[0]])
+ self.assertEquals(test_utils.CONF.database.connection,
+ 'fake_connection')
+

Revision history for this message
Gary Kotton (garyk) wrote :

Sorry, my bad with the example:

 from openstack.common.db import api
+from openstack.common.db.sqlalchemy import session
 from tests import utils as test_utils

@@ -55,6 +56,16 @@ class DBAPITestCase(test_utils.BaseTestCase):
         self.assertEquals(test_utils.CONF.database.backend, 'test_123')
         self.assertEquals(test_utils.CONF.database.use_tpool, True)

+ def test_dbapi_upper_case_deprecated_parameters(self):
+ paths = self.create_tempfiles([('test',
+ '[DATABASE]\n'
+ 'sql_connection=fake_connection\n'
+ )])
+
+ test_utils.CONF(['--config-file', paths[0]])
+ self.assertEquals(test_utils.CONF.database.connection,
+ 'fake_connection')
+

DBAPITestCase
    test_dbapi_api_class_method_and_tpool_false OK 0.00
    test_dbapi_api_class_method_and_tpool_true OK 0.37
    test_dbapi_full_path_module_method OK 0.00
    test_dbapi_parameters OK 0.00
    test_dbapi_unknown_invalid_backend OK 0.01
    test_dbapi_upper_case_deprecated_parameters FAIL 0.00
    test_deprecated_dbapi_parameters OK 0.00

======================================================================
FAIL: tests.unit.db.test_api.DBAPITestCase.test_dbapi_upper_case_deprecated_parameters
----------------------------------------------------------------------
_StringException: Empty attachments:
  pythonlogging:'openstack.common'

Traceback (most recent call last):
  File "/home/garyk/oslo-incubator/tests/unit/db/test_api.py", line 67, in test_dbapi_upper_case_deprecated_parameters
    'fake_connection')
  File "/home/garyk/oslo-incubator/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 322, in assertEqual
    self.assertThat(observed, matcher, message)
  File "/home/garyk/oslo-incubator/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 417, in assertThat
    raise MismatchError(matchee, matcher, mismatch, verbose)
MismatchError: !=:
reference = 'sqlite:////home/garyk/oslo-incubator/.tox/py27/local/lib/python2.7/site-packages/openstack/common/db/oslo.sqlite'
actual = 'fake_connection'

Revision history for this message
Gary Kotton (garyk) wrote :

I think that the issue at hand here is that there are two input types:

Quantum:

[DATABASE]
sql_connection=whatever

Nova:
[DEFAULT]
sql_connection=whatever

Thanks
Gary

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo-incubator (master)

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

Changed in oslo:
assignee: nobody → Gary Kotton (garyk)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo-incubator (master)

Reviewed: https://review.openstack.org/34096
Committed: http://github.com/openstack/oslo-incubator/commit/489e2b73f33d40ad34492fa7993f91bc52a8a66e
Submitter: Jenkins
Branch: master

commit 489e2b73f33d40ad34492fa7993f91bc52a8a66e
Author: Gary Kotton <email address hidden>
Date: Sat Jun 22 07:14:09 2013 +0000

    Ensure that DB configuration is backward compatible

    Fixes bug 1193557

    Change-Id: I483099b205c71d66cf97522307d8265abe83a488

Changed in oslo:
status: In Progress → Fix Committed
Mark McLoughlin (markmc)
Changed in oslo:
importance: Undecided → High
summary: - OSLO DB configurations not backward compatible
+ OSLO DB configurations not backward compatible with old quantum configs
Thierry Carrez (ttx)
Changed in oslo:
milestone: none → havana-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in oslo:
milestone: havana-2 → 2013.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.