From e23a66b86831e489ce3d05bbc59dde70898c47fa Mon Sep 17 00:00:00 2001 From: liusheng Date: Fri, 29 Jan 2016 11:30:50 +0800 Subject: [PATCH] Log deprecation message if users use nosql backend blueprint only-support-sqlalchemy-in-aodh Change-Id: I03b5dd14160dba37c992d04275155f7d9037edb0 --- aodh/storage/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/aodh/storage/__init__.py b/aodh/storage/__init__.py index 4af2b8fd0..e6d6e6895 100644 --- a/aodh/storage/__init__.py +++ b/aodh/storage/__init__.py @@ -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)