Move log alarms driver code to alarm tree
This change move the alarms related code of log driver to the alarm storage subtree. Partial implements blueprint dedicated-alarm-database Change-Id: I366dafefedc5944a1b1ee8358933228ee5a4cb21
This commit is contained in:
parent
9164d6f60b
commit
c6d8162a80
49
ceilometer/alarm/storage/impl_log.py
Normal file
49
ceilometer/alarm/storage/impl_log.py
Normal file
@ -0,0 +1,49 @@
|
||||
#
|
||||
# Copyright 2012 New Dream Network, LLC (DreamHost)
|
||||
#
|
||||
# Author: Doug Hellmann <doug.hellmann@dreamhost.com>
|
||||
#
|
||||
# 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.
|
||||
"""Simple logging storage backend.
|
||||
"""
|
||||
|
||||
from ceilometer.alarm.storage import base
|
||||
from ceilometer.openstack.common import log
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
class Connection(base.Connection):
|
||||
"""Log the data."""
|
||||
|
||||
def upgrade(self):
|
||||
pass
|
||||
|
||||
def clear(self):
|
||||
pass
|
||||
|
||||
def get_alarms(self, name=None, user=None, state=None, meter=None,
|
||||
project=None, enabled=None, alarm_id=None, pagination=None):
|
||||
"""Yields a lists of alarms that match filters."""
|
||||
return []
|
||||
|
||||
def create_alarm(self, alarm):
|
||||
"""Create alarm."""
|
||||
return alarm
|
||||
|
||||
def update_alarm(self, alarm):
|
||||
"""Update alarm."""
|
||||
return alarm
|
||||
|
||||
def delete_alarm(self, alarm_id):
|
||||
"""Delete an alarm."""
|
@ -17,7 +17,6 @@
|
||||
"""Simple logging storage backend.
|
||||
"""
|
||||
|
||||
from ceilometer.alarm.storage import base as alarm_base
|
||||
from ceilometer.openstack.common.gettextutils import _
|
||||
from ceilometer.openstack.common import log
|
||||
from ceilometer.storage import base
|
||||
@ -25,7 +24,7 @@ from ceilometer.storage import base
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
class Connection(base.Connection, alarm_base.Connection):
|
||||
class Connection(base.Connection):
|
||||
"""Log the data."""
|
||||
|
||||
def upgrade(self):
|
||||
@ -131,19 +130,3 @@ class Connection(base.Connection, alarm_base.Connection):
|
||||
}
|
||||
"""
|
||||
return []
|
||||
|
||||
def get_alarms(self, name=None, user=None, state=None, meter=None,
|
||||
project=None, enabled=None, alarm_id=None, pagination=None):
|
||||
"""Yields a lists of alarms that match filters."""
|
||||
return []
|
||||
|
||||
def create_alarm(self, alarm):
|
||||
"""Create alarm."""
|
||||
return alarm
|
||||
|
||||
def update_alarm(self, alarm):
|
||||
"""Update alarm."""
|
||||
return alarm
|
||||
|
||||
def delete_alarm(self, alarm_id):
|
||||
"""Delete an alarm."""
|
||||
|
@ -17,6 +17,7 @@
|
||||
"""Tests for ceilometer/storage/
|
||||
"""
|
||||
|
||||
from ceilometer.alarm.storage import impl_log as impl_log_alarm
|
||||
from ceilometer.openstack.common.fixture import config
|
||||
from ceilometer.openstack.common import test
|
||||
from ceilometer import storage
|
||||
@ -53,7 +54,7 @@ class ConnectionConfigTest(test.BaseTestCase):
|
||||
conn = storage.get_connection_from_config(self.CONF, 'metering')._conn
|
||||
self.assertIsInstance(conn, impl_log.Connection)
|
||||
conn = storage.get_connection_from_config(self.CONF, 'alarm')._conn
|
||||
self.assertIsInstance(conn, impl_log.Connection)
|
||||
self.assertIsInstance(conn, impl_log_alarm.Connection)
|
||||
|
||||
def test_two_urls(self):
|
||||
self.CONF.set_override("connection", "log://", group="database")
|
||||
|
@ -145,7 +145,7 @@ ceilometer.poll.central =
|
||||
network.services.lb.outgoing.bytes = ceilometer.network.services.lbaas:LBBytesOutPollster
|
||||
|
||||
ceilometer.alarm.storage =
|
||||
log = ceilometer.storage.impl_log:Connection
|
||||
log = ceilometer.alarm.storage.impl_log:Connection
|
||||
mongodb = ceilometer.alarm.storage.impl_mongodb:Connection
|
||||
mysql = ceilometer.storage.impl_sqlalchemy:Connection
|
||||
postgresql = ceilometer.storage.impl_sqlalchemy:Connection
|
||||
|
Loading…
Reference in New Issue
Block a user