Merge "Log deprecation message if users use nosql backend"

This commit is contained in:
Jenkins 2016-02-03 18:13:57 +00:00 committed by Gerrit Code Review
commit 716ddfb835

View File

@ -22,6 +22,7 @@ from oslo_utils import timeutils
import retrying
import six.moves.urllib.parse as urlparse
from stevedore import driver
import warnings
_NAMESPACE = 'aodh.storage'
@ -53,6 +54,12 @@ def get_connection_from_config(conf):
else:
url = conf.database.alarm_connection
connection_scheme = urlparse.urlparse(url).scheme
if connection_scheme not in ('mysql', 'mysql+pymysql', 'postgresql',
'sqlite'):
msg = ('Storage backend %s is deprecated, and all the NoSQL backends '
'will be removed in Aodh 4.0, please use SQL backend.' %
connection_scheme)
warnings.warn(msg)
LOG.debug('looking for %(name)r driver in %(namespace)r',
{'name': connection_scheme, 'namespace': _NAMESPACE})
mgr = driver.DriverManager(_NAMESPACE, connection_scheme)