diff --git a/aodh/alarm/rpc.py b/aodh/alarm/rpc.py index 6c35e085..6609873b 100644 --- a/aodh/alarm/rpc.py +++ b/aodh/alarm/rpc.py @@ -20,9 +20,9 @@ from oslo_context import context from oslo_log import log import six -from aodh.alarm.storage import models from aodh.i18n import _ from aodh import messaging +from aodh.storage import models OPTS = [ cfg.StrOpt('notifier_rpc_topic', diff --git a/aodh/alarm/storage/__init__.py b/aodh/alarm/storage/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/aodh/alarm/storage/base.py b/aodh/alarm/storage/base.py deleted file mode 100644 index 7dc3af9a..00000000 --- a/aodh/alarm/storage/base.py +++ /dev/null @@ -1,166 +0,0 @@ -# -# Copyright 2012 New Dream Network, LLC (DreamHost) -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -"""Base classes for storage engines -""" -import aodh - - -class Connection(object): - """Base class for alarm storage system connections.""" - - # A dictionary representing the capabilities of this driver. - CAPABILITIES = { - 'alarms': {'query': {'simple': False, - 'complex': False}, - 'history': {'query': {'simple': False, - 'complex': False}}}, - } - - STORAGE_CAPABILITIES = { - 'storage': {'production_ready': False}, - } - - def __init__(self, url): - pass - - @staticmethod - def upgrade(): - """Migrate the database to `version` or the most recent version.""" - - @staticmethod - def get_alarms(name=None, user=None, state=None, meter=None, - project=None, enabled=None, alarm_id=None, - alarm_type=None, severity=None): - """Yields a lists of alarms that match filters. - - :param name: Optional name for alarm. - :param user: Optional ID for user that owns the resource. - :param state: Optional string for alarm state. - :param meter: Optional string for alarms associated with meter. - :param project: Optional ID for project that owns the resource. - :param enabled: Optional boolean to list disable alarm. - :param alarm_id: Optional alarm_id to return one alarm. - :param alarm_type: Optional alarm type. - :parmr severity: Optional alarm severity - """ - raise aodh.NotImplementedError('Alarms not implemented') - - @staticmethod - def create_alarm(alarm): - """Create an alarm. Returns the alarm as created. - - :param alarm: The alarm to create. - """ - raise aodh.NotImplementedError('Alarms not implemented') - - @staticmethod - def update_alarm(alarm): - """Update alarm.""" - raise aodh.NotImplementedError('Alarms not implemented') - - @staticmethod - def delete_alarm(alarm_id): - """Delete an alarm.""" - raise aodh.NotImplementedError('Alarms not implemented') - - @staticmethod - def get_alarm_changes(alarm_id, on_behalf_of, - user=None, project=None, alarm_type=None, - severity=None, start_timestamp=None, - start_timestamp_op=None, end_timestamp=None, - end_timestamp_op=None): - """Yields list of AlarmChanges describing alarm history - - Changes are always sorted in reverse order of occurrence, given - the importance of currency. - - Segregation for non-administrative users is done on the basis - of the on_behalf_of parameter. This allows such users to have - visibility on both the changes initiated by themselves directly - (generally creation, rule changes, or deletion) and also on those - changes initiated on their behalf by the alarming service (state - transitions after alarm thresholds are crossed). - - :param alarm_id: ID of alarm to return changes for - :param on_behalf_of: ID of tenant to scope changes query (None for - administrative user, indicating all projects) - :param user: Optional ID of user to return changes for - :param project: Optional ID of project to return changes for - :param alarm_type: Optional change type - :param severity: Optional change severity - :param start_timestamp: Optional modified timestamp start range - :param start_timestamp_op: Optional timestamp start range operation - :param end_timestamp: Optional modified timestamp end range - :param end_timestamp_op: Optional timestamp end range operation - """ - raise aodh.NotImplementedError('Alarm history not implemented') - - @staticmethod - def record_alarm_change(alarm_change): - """Record alarm change event.""" - raise aodh.NotImplementedError('Alarm history not implemented') - - @staticmethod - def clear(): - """Clear database.""" - - @staticmethod - def query_alarms(filter_expr=None, orderby=None, limit=None): - """Return an iterable of model.Alarm objects. - - :param filter_expr: Filter expression for query. - :param orderby: List of field name and direction pairs for order by. - :param limit: Maximum number of results to return. - """ - - raise aodh.NotImplementedError('Complex query for alarms ' - 'is not implemented.') - - @staticmethod - def query_alarm_history(filter_expr=None, orderby=None, limit=None): - """Return an iterable of model.AlarmChange objects. - - :param filter_expr: Filter expression for query. - :param orderby: List of field name and direction pairs for order by. - :param limit: Maximum number of results to return. - """ - - raise aodh.NotImplementedError('Complex query for alarms ' - 'history is not implemented.') - - @classmethod - def get_capabilities(cls): - """Return an dictionary with the capabilities of each driver.""" - return cls.CAPABILITIES - - @classmethod - def get_storage_capabilities(cls): - """Return a dictionary representing the performance capabilities. - - This is needed to evaluate the performance of each driver. - """ - return cls.STORAGE_CAPABILITIES - - @staticmethod - def clear_expired_alarm_history_data(alarm_history_ttl): - """Clear expired alarm history data from the backend storage system. - - Clearing occurs according to the time-to-live. - - :param alarm_history_ttl: Number of seconds to keep alarm history - records for. - """ - raise aodh.NotImplementedError('Clearing alarm history ' - 'not implemented') diff --git a/aodh/api/controllers/v2/alarms.py b/aodh/api/controllers/v2/alarms.py index 7c11c24a..5edaccdd 100644 --- a/aodh/api/controllers/v2/alarms.py +++ b/aodh/api/controllers/v2/alarms.py @@ -39,13 +39,13 @@ import wsmeext.pecan as wsme_pecan import aodh from aodh import alarm as aodh_alarm -from aodh.alarm.storage import models as alarm_models from aodh.api.controllers.v2.alarm_rules import combination from aodh.api.controllers.v2 import base from aodh.api.controllers.v2 import utils as v2_utils from aodh.api import rbac from aodh.i18n import _ from aodh import messaging +from aodh.storage import models from aodh import utils LOG = log.getLogger(__name__) @@ -459,7 +459,7 @@ class AlarmController(rest.RestController): def _record_change(self, data, now, on_behalf_of=None, type=None): if not cfg.CONF.alarm.record_history: return - type = type or alarm_models.AlarmChange.RULE_CHANGE + type = type or models.AlarmChange.RULE_CHANGE scrubbed_data = utils.stringify_timestamps(data) detail = json.dumps(scrubbed_data) user_id = pecan.request.headers.get('X-User-Id') @@ -533,10 +533,10 @@ class AlarmController(rest.RestController): ALARMS_RULES[data.type].plugin.update_hook(data) - old_alarm = Alarm.from_db_model(alarm_in).as_dict(alarm_models.Alarm) - updated_alarm = data.as_dict(alarm_models.Alarm) + old_alarm = Alarm.from_db_model(alarm_in).as_dict(models.Alarm) + updated_alarm = data.as_dict(models.Alarm) try: - alarm_in = alarm_models.Alarm(**updated_alarm) + alarm_in = models.Alarm(**updated_alarm) except Exception: LOG.exception(_("Error while putting alarm: %s") % updated_alarm) raise base.ClientSideError(_("Alarm incorrect")) @@ -558,10 +558,10 @@ class AlarmController(rest.RestController): # ensure alarm exists before deleting alarm = self._alarm() self.conn.delete_alarm(alarm.alarm_id) - change = Alarm.from_db_model(alarm).as_dict(alarm_models.Alarm) + change = Alarm.from_db_model(alarm).as_dict(models.Alarm) self._record_change(change, timeutils.utcnow(), - type=alarm_models.AlarmChange.DELETION) + type=models.AlarmChange.DELETION) @wsme_pecan.wsexpose([AlarmChange], [base.Query]) def history(self, q=None): @@ -605,7 +605,7 @@ class AlarmController(rest.RestController): alarm = self.conn.update_alarm(alarm) change = {'state': alarm.state} self._record_change(change, now, on_behalf_of=alarm.project_id, - type=alarm_models.AlarmChange.STATE_TRANSITION) + type=models.AlarmChange.STATE_TRANSITION) return alarm.state @wsme_pecan.wsexpose(state_kind_enum) @@ -629,7 +629,7 @@ class AlarmsController(rest.RestController): def _record_creation(conn, data, alarm_id, now): if not cfg.CONF.alarm.record_history: return - type = alarm_models.AlarmChange.CREATION + type = models.AlarmChange.CREATION scrubbed_data = utils.stringify_timestamps(data) detail = json.dumps(scrubbed_data) user_id = pecan.request.headers.get('X-User-Id') @@ -691,7 +691,7 @@ class AlarmsController(rest.RestController): ALARMS_RULES[data.type].plugin.create_hook(data) - change = data.as_dict(alarm_models.Alarm) + change = data.as_dict(models.Alarm) # make sure alarms are unique by name per project. alarms = list(conn.get_alarms(name=data.name, @@ -702,7 +702,7 @@ class AlarmsController(rest.RestController): status_code=409) try: - alarm_in = alarm_models.Alarm(**change) + alarm_in = models.Alarm(**change) except Exception: LOG.exception(_("Error while posting alarm: %s") % change) raise base.ClientSideError(_("Alarm incorrect")) diff --git a/aodh/api/controllers/v2/query.py b/aodh/api/controllers/v2/query.py index 5f31a72a..ae0f7ae5 100644 --- a/aodh/api/controllers/v2/query.py +++ b/aodh/api/controllers/v2/query.py @@ -28,11 +28,11 @@ from pecan import rest from wsme import types as wtypes import wsmeext.pecan as wsme_pecan -from aodh.alarm.storage import models as alarm_models from aodh.api.controllers.v2 import alarms from aodh.api.controllers.v2 import base from aodh.api import rbac from aodh.i18n import _ +from aodh.storage import models from aodh import utils LOG = log.getLogger(__name__) @@ -339,7 +339,7 @@ class QueryAlarmHistoryController(rest.RestController): rbac.enforce('query_alarm_history', pecan.request) query = ValidatedComplexQuery(body, - alarm_models.AlarmChange) + models.AlarmChange) query.validate(visibility_field="on_behalf_of") conn = pecan.request.alarm_storage_conn return [alarms.AlarmChange.from_db_model(s) @@ -362,7 +362,7 @@ class QueryAlarmsController(rest.RestController): rbac.enforce('query_alarm', pecan.request) query = ValidatedComplexQuery(body, - alarm_models.Alarm) + models.Alarm) query.validate(visibility_field="project_id") conn = pecan.request.alarm_storage_conn return [alarms.Alarm.from_db_model(s) diff --git a/aodh/storage/base.py b/aodh/storage/base.py index 8e3d6846..0583d32a 100644 --- a/aodh/storage/base.py +++ b/aodh/storage/base.py @@ -19,6 +19,8 @@ import inspect import six +import aodh + class Model(object): """Base class for storage API models.""" @@ -46,3 +48,152 @@ class Model(object): def get_field_names(cls): fields = inspect.getargspec(cls.__init__)[0] return set(fields) - set(["self"]) + + +class Connection(object): + """Base class for alarm storage system connections.""" + + # A dictionary representing the capabilities of this driver. + CAPABILITIES = { + 'alarms': {'query': {'simple': False, + 'complex': False}, + 'history': {'query': {'simple': False, + 'complex': False}}}, + } + + STORAGE_CAPABILITIES = { + 'storage': {'production_ready': False}, + } + + def __init__(self, url): + pass + + @staticmethod + def upgrade(): + """Migrate the database to `version` or the most recent version.""" + + @staticmethod + def get_alarms(name=None, user=None, state=None, meter=None, + project=None, enabled=None, alarm_id=None, + alarm_type=None, severity=None): + """Yields a lists of alarms that match filters. + + :param name: Optional name for alarm. + :param user: Optional ID for user that owns the resource. + :param state: Optional string for alarm state. + :param meter: Optional string for alarms associated with meter. + :param project: Optional ID for project that owns the resource. + :param enabled: Optional boolean to list disable alarm. + :param alarm_id: Optional alarm_id to return one alarm. + :param alarm_type: Optional alarm type. + :parmr severity: Optional alarm severity + """ + raise aodh.NotImplementedError('Alarms not implemented') + + @staticmethod + def create_alarm(alarm): + """Create an alarm. Returns the alarm as created. + + :param alarm: The alarm to create. + """ + raise aodh.NotImplementedError('Alarms not implemented') + + @staticmethod + def update_alarm(alarm): + """Update alarm.""" + raise aodh.NotImplementedError('Alarms not implemented') + + @staticmethod + def delete_alarm(alarm_id): + """Delete an alarm.""" + raise aodh.NotImplementedError('Alarms not implemented') + + @staticmethod + def get_alarm_changes(alarm_id, on_behalf_of, + user=None, project=None, alarm_type=None, + severity=None, start_timestamp=None, + start_timestamp_op=None, end_timestamp=None, + end_timestamp_op=None): + """Yields list of AlarmChanges describing alarm history + + Changes are always sorted in reverse order of occurrence, given + the importance of currency. + + Segregation for non-administrative users is done on the basis + of the on_behalf_of parameter. This allows such users to have + visibility on both the changes initiated by themselves directly + (generally creation, rule changes, or deletion) and also on those + changes initiated on their behalf by the alarming service (state + transitions after alarm thresholds are crossed). + + :param alarm_id: ID of alarm to return changes for + :param on_behalf_of: ID of tenant to scope changes query (None for + administrative user, indicating all projects) + :param user: Optional ID of user to return changes for + :param project: Optional ID of project to return changes for + :param alarm_type: Optional change type + :param severity: Optional change severity + :param start_timestamp: Optional modified timestamp start range + :param start_timestamp_op: Optional timestamp start range operation + :param end_timestamp: Optional modified timestamp end range + :param end_timestamp_op: Optional timestamp end range operation + """ + raise aodh.NotImplementedError('Alarm history not implemented') + + @staticmethod + def record_alarm_change(alarm_change): + """Record alarm change event.""" + raise aodh.NotImplementedError('Alarm history not implemented') + + @staticmethod + def clear(): + """Clear database.""" + + @staticmethod + def query_alarms(filter_expr=None, orderby=None, limit=None): + """Return an iterable of model.Alarm objects. + + :param filter_expr: Filter expression for query. + :param orderby: List of field name and direction pairs for order by. + :param limit: Maximum number of results to return. + """ + + raise aodh.NotImplementedError('Complex query for alarms ' + 'is not implemented.') + + @staticmethod + def query_alarm_history(filter_expr=None, orderby=None, limit=None): + """Return an iterable of model.AlarmChange objects. + + :param filter_expr: Filter expression for query. + :param orderby: List of field name and direction pairs for order by. + :param limit: Maximum number of results to return. + """ + + raise aodh.NotImplementedError('Complex query for alarms ' + 'history is not implemented.') + + @classmethod + def get_capabilities(cls): + """Return an dictionary with the capabilities of each driver.""" + return cls.CAPABILITIES + + @classmethod + def get_storage_capabilities(cls): + """Return a dictionary representing the performance capabilities. + + This is needed to evaluate the performance of each driver. + """ + return cls.STORAGE_CAPABILITIES + + @staticmethod + def clear_expired_alarm_history_data(alarm_history_ttl): + """Clear expired alarm history data from the backend storage system. + + Clearing occurs according to the time-to-live. + + :param alarm_history_ttl: Number of seconds to keep alarm history + records for. + """ + raise aodh.NotImplementedError('Clearing alarm history ' + 'not implemented') diff --git a/aodh/alarm/storage/impl_db2.py b/aodh/storage/impl_db2.py similarity index 98% rename from aodh/alarm/storage/impl_db2.py rename to aodh/storage/impl_db2.py index 8e57e7ee..71422097 100644 --- a/aodh/alarm/storage/impl_db2.py +++ b/aodh/storage/impl_db2.py @@ -21,9 +21,9 @@ from __future__ import division from oslo_log import log import pymongo -from aodh.alarm.storage import pymongo_base from aodh import storage from aodh.storage.mongo import utils as pymongo_utils +from aodh.storage import pymongo_base LOG = log.getLogger(__name__) diff --git a/aodh/alarm/storage/impl_hbase.py b/aodh/storage/impl_hbase.py similarity index 98% rename from aodh/alarm/storage/impl_hbase.py rename to aodh/storage/impl_hbase.py index 8194f4f7..211e3be1 100644 --- a/aodh/alarm/storage/impl_hbase.py +++ b/aodh/storage/impl_hbase.py @@ -17,12 +17,12 @@ import operator from oslo_log import log import aodh -from aodh.alarm.storage import base -from aodh.alarm.storage import models from aodh.i18n import _ +from aodh.storage import base from aodh.storage.hbase import base as hbase_base from aodh.storage.hbase import migration as hbase_migration from aodh.storage.hbase import utils as hbase_utils +from aodh.storage import models from aodh import utils LOG = log.getLogger(__name__) diff --git a/aodh/alarm/storage/impl_log.py b/aodh/storage/impl_log.py similarity index 98% rename from aodh/alarm/storage/impl_log.py rename to aodh/storage/impl_log.py index 06eb6031..6ade968a 100644 --- a/aodh/alarm/storage/impl_log.py +++ b/aodh/storage/impl_log.py @@ -17,8 +17,8 @@ from oslo_log import log -from aodh.alarm.storage import base from aodh.i18n import _LI +from aodh.storage import base LOG = log.getLogger(__name__) diff --git a/aodh/alarm/storage/impl_mongodb.py b/aodh/storage/impl_mongodb.py similarity index 97% rename from aodh/alarm/storage/impl_mongodb.py rename to aodh/storage/impl_mongodb.py index 4d14286d..195cd873 100644 --- a/aodh/alarm/storage/impl_mongodb.py +++ b/aodh/storage/impl_mongodb.py @@ -24,11 +24,11 @@ from oslo_config import cfg from oslo_log import log import pymongo -from aodh.alarm.storage import pymongo_base from aodh import storage from aodh.storage.mongo import utils as pymongo_utils +from aodh.storage import pymongo_base -cfg.CONF.import_opt('alarm_history_time_to_live', 'aodh.alarm.storage', +cfg.CONF.import_opt('alarm_history_time_to_live', 'aodh.storage', group="database") LOG = log.getLogger(__name__) diff --git a/aodh/alarm/storage/impl_sqlalchemy.py b/aodh/storage/impl_sqlalchemy.py similarity index 99% rename from aodh/alarm/storage/impl_sqlalchemy.py rename to aodh/storage/impl_sqlalchemy.py index 61ea766f..32a10aa9 100644 --- a/aodh/alarm/storage/impl_sqlalchemy.py +++ b/aodh/storage/impl_sqlalchemy.py @@ -21,9 +21,9 @@ from oslo_log import log from oslo_utils import timeutils from sqlalchemy import desc -from aodh.alarm.storage import base -from aodh.alarm.storage import models as alarm_api_models from aodh.i18n import _LI +from aodh.storage import base +from aodh.storage import models as alarm_api_models from aodh.storage.sqlalchemy import models from aodh.storage.sqlalchemy import utils as sql_utils from aodh import utils diff --git a/aodh/alarm/storage/models.py b/aodh/storage/models.py similarity index 100% rename from aodh/alarm/storage/models.py rename to aodh/storage/models.py diff --git a/aodh/alarm/storage/pymongo_base.py b/aodh/storage/pymongo_base.py similarity index 99% rename from aodh/alarm/storage/pymongo_base.py rename to aodh/storage/pymongo_base.py index 1a4a460f..e30a11be 100644 --- a/aodh/alarm/storage/pymongo_base.py +++ b/aodh/storage/pymongo_base.py @@ -21,8 +21,8 @@ from oslo_log import log import pymongo -from aodh.alarm.storage import base -from aodh.alarm.storage import models +from aodh.storage import base +from aodh.storage import models from aodh.storage.mongo import utils as pymongo_utils from aodh import utils diff --git a/aodh/tests/alarm/evaluator/test_combination.py b/aodh/tests/alarm/evaluator/test_combination.py index 607a9a03..f3d7756c 100644 --- a/aodh/tests/alarm/evaluator/test_combination.py +++ b/aodh/tests/alarm/evaluator/test_combination.py @@ -28,7 +28,7 @@ from oslo_utils import timeutils import pytz from aodh.alarm.evaluator import combination -from aodh.alarm.storage import models +from aodh.storage import models from aodh.tests.alarm.evaluator import base from aodh.tests import constants diff --git a/aodh/tests/alarm/evaluator/test_gnocchi.py b/aodh/tests/alarm/evaluator/test_gnocchi.py index ed84b383..3ad61a6a 100644 --- a/aodh/tests/alarm/evaluator/test_gnocchi.py +++ b/aodh/tests/alarm/evaluator/test_gnocchi.py @@ -26,7 +26,7 @@ import six from six import moves from aodh.alarm.evaluator import gnocchi -from aodh.alarm.storage import models +from aodh.storage import models from aodh.tests.alarm.evaluator import base from aodh.tests import constants diff --git a/aodh/tests/alarm/evaluator/test_threshold.py b/aodh/tests/alarm/evaluator/test_threshold.py index 91298419..3d2285e1 100644 --- a/aodh/tests/alarm/evaluator/test_threshold.py +++ b/aodh/tests/alarm/evaluator/test_threshold.py @@ -26,7 +26,7 @@ import pytz from six import moves from aodh.alarm.evaluator import threshold -from aodh.alarm.storage import models +from aodh.storage import models from aodh.tests.alarm.evaluator import base from aodh.tests import constants diff --git a/aodh/tests/alarm/test_rpc.py b/aodh/tests/alarm/test_rpc.py index 867863c1..4688dab8 100644 --- a/aodh/tests/alarm/test_rpc.py +++ b/aodh/tests/alarm/test_rpc.py @@ -22,8 +22,8 @@ from oslo_config import fixture as fixture_config import six from aodh.alarm import rpc as rpc_alarm -from aodh.alarm.storage import models from aodh import messaging +from aodh.storage import models from aodh.tests import base as tests_base diff --git a/aodh/tests/api/v2/test_alarm_scenarios.py b/aodh/tests/api/v2/test_alarm_scenarios.py index d011b117..aa38bb54 100644 --- a/aodh/tests/api/v2/test_alarm_scenarios.py +++ b/aodh/tests/api/v2/test_alarm_scenarios.py @@ -25,8 +25,8 @@ import six from six import moves import six.moves.urllib.parse as urlparse -from aodh.alarm.storage import models from aodh import messaging +from aodh.storage import models from aodh.tests.api import v2 from aodh.tests import constants from aodh.tests import db as tests_db diff --git a/aodh/tests/api/v2/test_complex_query.py b/aodh/tests/api/v2/test_complex_query.py index 40971763..bddc28a3 100644 --- a/aodh/tests/api/v2/test_complex_query.py +++ b/aodh/tests/api/v2/test_complex_query.py @@ -24,8 +24,8 @@ import mock from oslotest import base import wsme -from aodh.alarm.storage import models as alarm_models from aodh.api.controllers.v2 import query +from aodh.storage import models as alarm_models class FakeComplexQuery(query.ValidatedComplexQuery): diff --git a/aodh/tests/api/v2/test_complex_query_scenarios.py b/aodh/tests/api/v2/test_complex_query_scenarios.py index c078ea37..c46bde0a 100644 --- a/aodh/tests/api/v2/test_complex_query_scenarios.py +++ b/aodh/tests/api/v2/test_complex_query_scenarios.py @@ -22,7 +22,7 @@ import datetime from oslo_utils import timeutils -from aodh.alarm.storage import models +from aodh.storage import models from aodh.tests.api import v2 as tests_api from aodh.tests import db as tests_db diff --git a/aodh/tests/api/v2/test_query.py b/aodh/tests/api/v2/test_query.py index 0aae249b..950d1546 100644 --- a/aodh/tests/api/v2/test_query.py +++ b/aodh/tests/api/v2/test_query.py @@ -23,10 +23,10 @@ from oslotest import base from oslotest import mockpatch import wsme -from aodh.alarm.storage import base as alarm_storage_base from aodh.api.controllers.v2 import base as v2_base from aodh.api.controllers.v2 import utils from aodh import storage +from aodh.storage import base as alarm_storage_base from aodh.tests import base as tests_base diff --git a/aodh/tests/storage/test_get_connection.py b/aodh/tests/storage/test_get_connection.py index e87f74c7..692e9663 100644 --- a/aodh/tests/storage/test_get_connection.py +++ b/aodh/tests/storage/test_get_connection.py @@ -19,8 +19,8 @@ from oslo_config import fixture as fixture_config from oslotest import base import retrying -from aodh.alarm.storage import impl_log from aodh import storage +from aodh.storage import impl_log import six diff --git a/aodh/tests/storage/test_impl_db2.py b/aodh/tests/storage/test_impl_db2.py index 129ff63e..b8e6c860 100644 --- a/aodh/tests/storage/test_impl_db2.py +++ b/aodh/tests/storage/test_impl_db2.py @@ -23,7 +23,7 @@ """ -from aodh.alarm.storage import impl_db2 +from aodh.storage import impl_db2 from aodh.tests import base as test_base diff --git a/aodh/tests/storage/test_impl_hbase.py b/aodh/tests/storage/test_impl_hbase.py index 0046309f..423c4eef 100644 --- a/aodh/tests/storage/test_impl_hbase.py +++ b/aodh/tests/storage/test_impl_hbase.py @@ -28,7 +28,7 @@ except ImportError: import testtools.testcase raise testtools.testcase.TestSkipped("happybase is needed") -from aodh.alarm.storage import impl_hbase +from aodh.storage import impl_hbase from aodh.tests import base as test_base from aodh.tests import db as tests_db diff --git a/aodh/tests/storage/test_impl_log.py b/aodh/tests/storage/test_impl_log.py index 7ce7eae3..1a146719 100644 --- a/aodh/tests/storage/test_impl_log.py +++ b/aodh/tests/storage/test_impl_log.py @@ -16,7 +16,7 @@ """ from oslotest import base -from aodh.alarm.storage import impl_log +from aodh.storage import impl_log class ConnectionTest(base.BaseTestCase): diff --git a/aodh/tests/storage/test_impl_mongodb.py b/aodh/tests/storage/test_impl_mongodb.py index 8dc61de9..872d1735 100644 --- a/aodh/tests/storage/test_impl_mongodb.py +++ b/aodh/tests/storage/test_impl_mongodb.py @@ -21,7 +21,7 @@ """ -from aodh.alarm.storage import impl_mongodb as impl_mongodb +from aodh.storage import impl_mongodb from aodh.tests import base as test_base from aodh.tests import db as tests_db diff --git a/aodh/tests/storage/test_impl_sqlalchemy.py b/aodh/tests/storage/test_impl_sqlalchemy.py index 427297be..a9c7f417 100644 --- a/aodh/tests/storage/test_impl_sqlalchemy.py +++ b/aodh/tests/storage/test_impl_sqlalchemy.py @@ -18,7 +18,7 @@ """ -from aodh.alarm.storage import impl_sqlalchemy as impl_sqla_alarm +from aodh.storage import impl_sqlalchemy as impl_sqla_alarm from aodh.tests import base as test_base diff --git a/aodh/tests/storage/test_storage_scenarios.py b/aodh/tests/storage/test_storage_scenarios.py index 501f5d0d..3d13331f 100644 --- a/aodh/tests/storage/test_storage_scenarios.py +++ b/aodh/tests/storage/test_storage_scenarios.py @@ -20,7 +20,7 @@ import datetime import mock from oslo_utils import timeutils -from aodh.alarm.storage import models as alarm_models +from aodh.storage import models as alarm_models from aodh.tests import constants from aodh.tests import db as tests_db diff --git a/setup.cfg b/setup.cfg index 058995f0..604d4396 100644 --- a/setup.cfg +++ b/setup.cfg @@ -27,13 +27,13 @@ packages = [entry_points] aodh.alarm.storage = - log = aodh.alarm.storage.impl_log:Connection - mongodb = aodh.alarm.storage.impl_mongodb:Connection - mysql = aodh.alarm.storage.impl_sqlalchemy:Connection - postgresql = aodh.alarm.storage.impl_sqlalchemy:Connection - sqlite = aodh.alarm.storage.impl_sqlalchemy:Connection - hbase = aodh.alarm.storage.impl_hbase:Connection - db2 = aodh.alarm.storage.impl_db2:Connection + log = aodh.storage.impl_log:Connection + mongodb = aodh.storage.impl_mongodb:Connection + mysql = aodh.storage.impl_sqlalchemy:Connection + postgresql = aodh.storage.impl_sqlalchemy:Connection + sqlite = aodh.storage.impl_sqlalchemy:Connection + hbase = aodh.storage.impl_hbase:Connection + db2 = aodh.storage.impl_db2:Connection aodh.alarm.rule = threshold = aodh.api.controllers.v2.alarm_rules.threshold:AlarmThresholdRule