evaluator: move to top-level
This moves evaluator from alarm/ to top-level. It removes the "alarm" group options for its options, and remove the alarm prefix in various place. Change-Id: I1bbefada4d5907049738e0b6bb304bcc16db934a
This commit is contained in:
parent
795bdb80b6
commit
c01e6bc400
@ -24,7 +24,7 @@ from aodh.api.controllers.v2 import utils as v2_utils
|
||||
from aodh import keystone_client
|
||||
|
||||
|
||||
cfg.CONF.import_opt('gnocchi_url', 'aodh.alarm.evaluator.gnocchi',
|
||||
cfg.CONF.import_opt('gnocchi_url', 'aodh.evaluator.gnocchi',
|
||||
group="alarms")
|
||||
|
||||
|
||||
|
@ -70,7 +70,7 @@ ALARM_API_OPTS = [
|
||||
]
|
||||
|
||||
cfg.CONF.register_opts(ALARM_API_OPTS, group='alarm')
|
||||
cfg.CONF.import_opt('record_history', 'aodh.alarm.evaluator', 'alarm')
|
||||
cfg.CONF.import_opt('record_history', 'aodh.evaluator')
|
||||
|
||||
state_kind = ["ok", "alarm", "insufficient data"]
|
||||
state_kind_enum = wtypes.Enum(str, *state_kind)
|
||||
@ -507,7 +507,7 @@ class AlarmController(rest.RestController):
|
||||
return alarms[0]
|
||||
|
||||
def _record_change(self, data, now, on_behalf_of=None, type=None):
|
||||
if not cfg.CONF.alarm.record_history:
|
||||
if not cfg.CONF.record_history:
|
||||
return
|
||||
type = type or models.AlarmChange.RULE_CHANGE
|
||||
scrubbed_data = utils.stringify_timestamps(data)
|
||||
@ -681,7 +681,7 @@ class AlarmsController(rest.RestController):
|
||||
|
||||
@staticmethod
|
||||
def _record_creation(conn, data, alarm_id, now):
|
||||
if not cfg.CONF.alarm.record_history:
|
||||
if not cfg.CONF.record_history:
|
||||
return
|
||||
type = models.AlarmChange.CREATION
|
||||
scrubbed_data = utils.stringify_timestamps(data)
|
||||
|
@ -45,11 +45,12 @@ ALARM = 'alarm'
|
||||
OPTS = [
|
||||
cfg.BoolOpt('record_history',
|
||||
default=True,
|
||||
deprecated_group="alarm",
|
||||
help='Record alarm change events.'
|
||||
),
|
||||
]
|
||||
|
||||
cfg.CONF.register_opts(OPTS, group="alarm")
|
||||
cfg.CONF.register_opts(OPTS)
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
@ -67,7 +68,7 @@ class Evaluator(object):
|
||||
return self.storage_conn
|
||||
|
||||
def _record_change(self, alarm):
|
||||
if not cfg.CONF.alarm.record_history:
|
||||
if not cfg.CONF.record_history:
|
||||
return
|
||||
type = models.AlarmChange.STATE_TRANSITION
|
||||
detail = json.dumps({'state': alarm.state})
|
||||
@ -93,7 +94,7 @@ class Evaluator(object):
|
||||
notification = "alarm.state_transition"
|
||||
transport = messaging.get_transport()
|
||||
notifier = messaging.get_notifier(transport,
|
||||
publisher_id="aodh.alarm.evaluator")
|
||||
publisher_id="aodh.evaluator")
|
||||
notifier.info(context.RequestContext(), notification, payload)
|
||||
|
||||
def _refresh(self, alarm, state, reason, reason_data):
|
@ -19,7 +19,7 @@
|
||||
from oslo_log import log
|
||||
from six import moves
|
||||
|
||||
from aodh.alarm import evaluator
|
||||
from aodh import evaluator
|
||||
from aodh.i18n import _
|
||||
|
||||
LOG = log.getLogger(__name__)
|
@ -13,12 +13,12 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from aodh.alarm.evaluator import threshold
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
from oslo_serialization import jsonutils
|
||||
import requests
|
||||
|
||||
from aodh.evaluator import threshold
|
||||
from aodh.i18n import _
|
||||
from aodh import keystone_client
|
||||
|
@ -22,8 +22,8 @@ from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
from oslo_utils import timeutils
|
||||
|
||||
from aodh.alarm import evaluator
|
||||
from aodh.alarm.evaluator import utils
|
||||
from aodh import evaluator
|
||||
from aodh.evaluator import utils
|
||||
from aodh.i18n import _, _LW
|
||||
|
||||
LOG = log.getLogger(__name__)
|
@ -17,6 +17,7 @@ import aodh.api
|
||||
import aodh.api.app
|
||||
import aodh.api.controllers.v2.alarms
|
||||
import aodh.coordination
|
||||
import aodh.evaluator.gnocchi
|
||||
import aodh.notifier.rest
|
||||
import aodh.rpc
|
||||
import aodh.service
|
||||
@ -27,13 +28,12 @@ def list_opts():
|
||||
return [
|
||||
('DEFAULT',
|
||||
itertools.chain(aodh.api.app.OPTS,
|
||||
aodh.evaluator.gnocchi.OPTS,
|
||||
aodh.notifier.rest.OPTS,
|
||||
aodh.service.OPTS,
|
||||
aodh.rpc.OPTS,
|
||||
aodh.storage.OLD_OPTS,)),
|
||||
('alarm',
|
||||
itertools.chain(aodh.alarm.evaluator.gnocchi.OPTS,
|
||||
aodh.api.controllers.v2.alarms.ALARM_API_OPTS)),
|
||||
('alarm', aodh.api.controllers.v2.alarms.ALARM_API_OPTS),
|
||||
('api',
|
||||
itertools.chain(aodh.api.OPTS,
|
||||
aodh.api.app.API_OPTS,)),
|
||||
|
@ -135,7 +135,7 @@ def prepare_service(argv=None):
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class AlarmService(object):
|
||||
EVALUATOR_EXTENSIONS_NAMESPACE = "aodh.alarm.evaluator"
|
||||
EVALUATOR_EXTENSIONS_NAMESPACE = "aodh.evaluator"
|
||||
|
||||
def __init__(self):
|
||||
super(AlarmService, self).__init__()
|
||||
|
@ -2537,14 +2537,14 @@ class TestAlarmsHistory(TestAlarmsBase):
|
||||
'%s not in %s' % (fragment, actual))
|
||||
|
||||
def test_record_alarm_history_config(self):
|
||||
self.CONF.set_override('record_history', False, group='alarm')
|
||||
self.CONF.set_override('record_history', False)
|
||||
alarm = self._get_alarm('a')
|
||||
history = self._get_alarm_history(alarm)
|
||||
self.assertEqual([], history)
|
||||
self._update_alarm(alarm, dict(name='renamed'))
|
||||
history = self._get_alarm_history(alarm)
|
||||
self.assertEqual([], history)
|
||||
self.CONF.set_override('record_history', True, group='alarm')
|
||||
self.CONF.set_override('record_history', True)
|
||||
self._update_alarm(alarm, dict(name='foobar'))
|
||||
history = self._get_alarm_history(alarm)
|
||||
self.assertEqual(1, len(history))
|
||||
|
@ -12,7 +12,7 @@
|
||||
# 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 class for tests in aodh/alarm/evaluator/
|
||||
"""Base class for tests in aodh/evaluator/
|
||||
"""
|
||||
import mock
|
||||
from oslotest import base
|
@ -12,7 +12,7 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
"""class for tests in aodh/alarm/evaluator/__init__.py
|
||||
"""class for tests in aodh/evaluator/__init__.py
|
||||
"""
|
||||
import datetime
|
||||
|
||||
@ -20,7 +20,7 @@ import mock
|
||||
from oslo_utils import timeutils
|
||||
from oslotest import base
|
||||
|
||||
from aodh.alarm import evaluator
|
||||
from aodh import evaluator
|
||||
|
||||
|
||||
class TestEvaluatorBaseClass(base.BaseTestCase):
|
@ -15,7 +15,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""Tests for aodh/alarm/evaluator/combination.py
|
||||
"""Tests for aodh/evaluator/combination.py
|
||||
"""
|
||||
|
||||
import datetime
|
||||
@ -27,10 +27,10 @@ import mock
|
||||
from oslo_utils import timeutils
|
||||
import pytz
|
||||
|
||||
from aodh.alarm.evaluator import combination
|
||||
from aodh.evaluator import combination
|
||||
from aodh.storage import models
|
||||
from aodh.tests.alarm.evaluator import base
|
||||
from aodh.tests import constants
|
||||
from aodh.tests.evaluator import base
|
||||
|
||||
|
||||
class TestEvaluate(base.TestEvaluatorBase):
|
@ -25,10 +25,10 @@ import pytz
|
||||
import six
|
||||
from six import moves
|
||||
|
||||
from aodh.alarm.evaluator import gnocchi
|
||||
from aodh.evaluator import gnocchi
|
||||
from aodh.storage import models
|
||||
from aodh.tests.alarm.evaluator import base
|
||||
from aodh.tests import constants
|
||||
from aodh.tests.evaluator import base
|
||||
|
||||
|
||||
class FakeResponse(object):
|
||||
@ -56,7 +56,7 @@ class TestGnocchiThresholdEvaluate(base.TestEvaluatorBase):
|
||||
self.useFixture(mockpatch.Patch('ceilometerclient.client.get_client',
|
||||
return_value=self.api_client))
|
||||
self.requests = self.useFixture(mockpatch.Patch(
|
||||
'aodh.alarm.evaluator.gnocchi.requests')).mock
|
||||
'aodh.evaluator.gnocchi.requests')).mock
|
||||
|
||||
def prepare_alarms(self):
|
||||
self.alarms = [
|
@ -12,7 +12,7 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
"""Tests for aodh/alarm/evaluator/threshold.py
|
||||
"""Tests for aodh/evaluator/threshold.py
|
||||
"""
|
||||
import datetime
|
||||
import uuid
|
||||
@ -25,10 +25,10 @@ from oslo_utils import timeutils
|
||||
import pytz
|
||||
from six import moves
|
||||
|
||||
from aodh.alarm.evaluator import threshold
|
||||
from aodh.evaluator import threshold
|
||||
from aodh.storage import models
|
||||
from aodh.tests.alarm.evaluator import base
|
||||
from aodh.tests import constants
|
||||
from aodh.tests.evaluator import base
|
||||
|
||||
|
||||
class TestEvaluate(base.TestEvaluatorBase):
|
@ -264,7 +264,7 @@ function start_aodh {
|
||||
fi
|
||||
|
||||
run_process aodh-notifier "$AODH_BIN_DIR/aodh-notifier --config-file $AODH_CONF"
|
||||
run_process aodh-alarm-evaluator "$AODH_BIN_DIR/aodh-alarm-evaluator --config-file $AODH_CONF"
|
||||
run_process aodh-evaluator "$AODH_BIN_DIR/aodh-evaluator --config-file $AODH_CONF"
|
||||
}
|
||||
|
||||
# stop_aodh() - Stop running processes
|
||||
@ -274,7 +274,7 @@ function stop_aodh {
|
||||
restart_apache_server
|
||||
fi
|
||||
# Kill the aodh screen windows
|
||||
for serv in aodh-api aodh-notifier aodh-alarm-evaluator; do
|
||||
for serv in aodh-api aodh-notifier aodh-evaluator; do
|
||||
stop_process $serv
|
||||
done
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
# API service
|
||||
enable_service aodh-api
|
||||
# Alarming
|
||||
enable_service aodh-notifier aodh-alarm-evaluator
|
||||
enable_service aodh-notifier aodh-evaluator
|
||||
# Ensure legacy ceilometer alarm stuffs is disabled
|
||||
disable_service ceilometer-alarm-notifier ceilometer-alarm-evaluator
|
||||
|
||||
|
@ -45,7 +45,7 @@ Configuring devstack
|
||||
[[local|localrc]]
|
||||
|
||||
# Enable the aodh alarming services
|
||||
enable_service aodh-alarm-evaluator,aodh-notifier
|
||||
enable_service aodh-evaluator,aodh-notifier
|
||||
|
||||
The first group of daemons are necessary for core aodh functionality:
|
||||
polling, event listening, and data collection.
|
||||
|
14
setup.cfg
14
setup.cfg
@ -42,12 +42,12 @@ aodh.alarm.rule =
|
||||
gnocchi_aggregation_by_metrics_threshold = aodh.api.controllers.v2.alarm_rules.gnocchi:AggregationMetricsByIdLookupRule
|
||||
gnocchi_aggregation_by_resources_threshold = aodh.api.controllers.v2.alarm_rules.gnocchi:AggregationMetricByResourcesLookupRule
|
||||
|
||||
aodh.alarm.evaluator =
|
||||
threshold = aodh.alarm.evaluator.threshold:ThresholdEvaluator
|
||||
combination = aodh.alarm.evaluator.combination:CombinationEvaluator
|
||||
gnocchi_resources_threshold = aodh.alarm.evaluator.gnocchi:GnocchiThresholdEvaluator
|
||||
gnocchi_aggregation_by_metrics_threshold = aodh.alarm.evaluator.gnocchi:GnocchiThresholdEvaluator
|
||||
gnocchi_aggregation_by_resources_threshold = aodh.alarm.evaluator.gnocchi:GnocchiThresholdEvaluator
|
||||
aodh.evaluator =
|
||||
threshold = aodh.evaluator.threshold:ThresholdEvaluator
|
||||
combination = aodh.evaluator.combination:CombinationEvaluator
|
||||
gnocchi_resources_threshold = aodh.evaluator.gnocchi:GnocchiThresholdEvaluator
|
||||
gnocchi_aggregation_by_metrics_threshold = aodh.evaluator.gnocchi:GnocchiThresholdEvaluator
|
||||
gnocchi_aggregation_by_resources_threshold = aodh.evaluator.gnocchi:GnocchiThresholdEvaluator
|
||||
|
||||
aodh.notifier =
|
||||
log = aodh.notifier.log:LogAlarmNotifier
|
||||
@ -61,7 +61,7 @@ console_scripts =
|
||||
aodh-api = aodh.cmd.api:main
|
||||
aodh-dbsync = aodh.cmd.eventlet.storage:dbsync
|
||||
aodh-expirer = aodh.cmd.eventlet.storage:expirer
|
||||
aodh-alarm-evaluator = aodh.cmd.eventlet.alarm:evaluator
|
||||
aodh-evaluator = aodh.cmd.eventlet.alarm:evaluator
|
||||
aodh-notifier = aodh.cmd.eventlet.alarm:notifier
|
||||
|
||||
oslo.config.opts =
|
||||
|
Loading…
x
Reference in New Issue
Block a user