don't pass aodh options to oslo.db engine facade

oslo.db EngineFacade class only support options defined by oslo.db,
but we also pass options defined by aodh, so oslo.db complains
with a warning message:

NotSupportedWarning: Configuration option(s) ['alarm_connection', \
'alarm_history_time_to_live'] not supported

This patch makes sure only options defined by oslo.db will be sent
to EngineFacade

Change-Id: I4c259f29af1cab60c3aee41a610b12f64ed5f2d5
Closes-Bug: #1516515
This commit is contained in:
ZhiQiang Fan 2015-11-17 04:38:27 +08:00
parent 0b1cc7ac8c
commit 2b3e3f0de6

View File

@ -26,6 +26,7 @@ import six
from sqlalchemy import desc
from aodh.i18n import _LI
from aodh import storage
from aodh.storage import base
from aodh.storage import models as alarm_api_models
from aodh.storage.sqlalchemy import models
@ -63,8 +64,11 @@ class Connection(base.Connection):
# in storage.__init__.get_connection_from_config function
options = dict(conf.database.items())
options['max_retries'] = 0
self.conf = conf
# oslo.db doesn't support options defined by Aodh
for opt in storage.OPTS:
options.pop(opt.name, None)
self._engine_facade = db_session.EngineFacade(url, **options)
self.conf = conf
def disconnect(self):
self._engine_facade.get_engine().dispose()