From cf53ba65ed1e752a5f60e5fd223447ad190eae2d Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Fri, 10 Jul 2015 17:41:38 +0200 Subject: [PATCH] Move aodh.alarm.rpc to aodh.rpc Change-Id: I54367f3edfee7b983f0a4a6de0495a1b5b5fa96a --- aodh/opts.py | 4 ++-- aodh/{alarm => }/rpc.py | 5 +++-- aodh/service.py | 6 +++--- aodh/tests/{alarm => }/test_rpc.py | 4 ++-- 4 files changed, 10 insertions(+), 9 deletions(-) rename aodh/{alarm => }/rpc.py (94%) rename aodh/tests/{alarm => }/test_rpc.py (98%) diff --git a/aodh/opts.py b/aodh/opts.py index da3f30a39..ffb9a2ceb 100644 --- a/aodh/opts.py +++ b/aodh/opts.py @@ -14,11 +14,11 @@ import itertools import aodh.alarm.notifier.rest -import aodh.alarm.rpc import aodh.api import aodh.api.app import aodh.api.controllers.v2.alarms import aodh.coordination +import aodh.rpc import aodh.service import aodh.storage @@ -28,10 +28,10 @@ def list_opts(): ('DEFAULT', itertools.chain(aodh.api.app.OPTS, aodh.service.OPTS, + aodh.rpc.OPTS, aodh.storage.OLD_OPTS,)), ('alarm', itertools.chain(aodh.alarm.notifier.rest.OPTS, - aodh.alarm.rpc.OPTS, aodh.alarm.evaluator.gnocchi.OPTS, aodh.api.controllers.v2.alarms.ALARM_API_OPTS)), ('api', diff --git a/aodh/alarm/rpc.py b/aodh/rpc.py similarity index 94% rename from aodh/alarm/rpc.py rename to aodh/rpc.py index 6609873b4..1719bb9c5 100644 --- a/aodh/alarm/rpc.py +++ b/aodh/rpc.py @@ -27,11 +27,12 @@ from aodh.storage import models OPTS = [ cfg.StrOpt('notifier_rpc_topic', default='alarm_notifier', + deprecated_group='alarm', help='The topic that aodh uses for alarm notifier ' 'messages.'), ] -cfg.CONF.register_opts(OPTS, group='alarm') +cfg.CONF.register_opts(OPTS) LOG = log.getLogger(__name__) @@ -40,7 +41,7 @@ class RPCAlarmNotifier(object): def __init__(self): transport = messaging.get_transport() self.client = messaging.get_rpc_client( - transport, topic=cfg.CONF.alarm.notifier_rpc_topic, + transport, topic=cfg.CONF.notifier_rpc_topic, version="1.0") def notify(self, alarm, previous, reason, reason_data): diff --git a/aodh/service.py b/aodh/service.py index 39f3e8be0..a0cd827d7 100644 --- a/aodh/service.py +++ b/aodh/service.py @@ -27,10 +27,10 @@ from oslo_utils import netutils import six from stevedore import extension -from aodh.alarm import rpc as rpc_alarm from aodh import coordination from aodh.i18n import _ from aodh import messaging +from aodh import rpc from aodh import storage from aodh import utils @@ -152,7 +152,7 @@ class AlarmService(object): self.evaluators = extension.ExtensionManager( namespace=self.EVALUATOR_EXTENSIONS_NAMESPACE, invoke_on_load=True, - invoke_args=(rpc_alarm.RPCAlarmNotifier(),) + invoke_args=(rpc.RPCAlarmNotifier(),) ) def _evaluate_assigned_alarms(self): @@ -227,7 +227,7 @@ class AlarmNotifierService(os_service.Service): super(AlarmNotifierService, self).__init__() transport = messaging.get_transport() self.rpc_server = messaging.get_rpc_server( - transport, cfg.CONF.alarm.notifier_rpc_topic, self) + transport, cfg.CONF.notifier_rpc_topic, self) self.notifiers = extension.ExtensionManager( self.NOTIFIER_EXTENSIONS_NAMESPACE, diff --git a/aodh/tests/alarm/test_rpc.py b/aodh/tests/test_rpc.py similarity index 98% rename from aodh/tests/alarm/test_rpc.py rename to aodh/tests/test_rpc.py index 4688dab85..0606e2893 100644 --- a/aodh/tests/alarm/test_rpc.py +++ b/aodh/tests/test_rpc.py @@ -21,8 +21,8 @@ from ceilometerclient.v2 import alarms from oslo_config import fixture as fixture_config import six -from aodh.alarm import rpc as rpc_alarm from aodh import messaging +from aodh import rpc from aodh.storage import models from aodh.tests import base as tests_base @@ -50,7 +50,7 @@ class TestRPCAlarmNotifier(tests_base.BaseTestCase): self.setup_messaging(self.CONF) self.notifier_server = FakeNotifier(self.transport) - self.notifier = rpc_alarm.RPCAlarmNotifier() + self.notifier = rpc.RPCAlarmNotifier() self.alarms = [ alarms.Alarm(None, info={ 'name': 'instance_running_hot',