Merge "remove db2 nosql driver"
This commit is contained in:
commit
2bea49e495
@ -49,11 +49,6 @@ F: api/
|
||||
|
||||
== storage ==
|
||||
|
||||
-- DB2 --
|
||||
M: Tong Li (litong) <litong01@us.ibm.com>
|
||||
S: Maintained
|
||||
F: storage/impl_db2.py
|
||||
|
||||
-- HBase --
|
||||
M:
|
||||
S: Orphan
|
||||
|
@ -1,76 +0,0 @@
|
||||
# Copyright 2012 New Dream Network, LLC (DreamHost)
|
||||
# Copyright 2013 eNovance
|
||||
# Copyright 2013 IBM Corp
|
||||
#
|
||||
# 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.
|
||||
"""DB2 storage backend
|
||||
"""
|
||||
|
||||
from __future__ import division
|
||||
|
||||
from oslo_log import log
|
||||
import pymongo
|
||||
|
||||
from aodh import storage
|
||||
from aodh.storage.mongo import utils as pymongo_utils
|
||||
from aodh.storage import pymongo_base
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
class Connection(pymongo_base.Connection):
|
||||
"""The db2 alarm storage for aodh."""
|
||||
|
||||
CONNECTION_POOL = pymongo_utils.ConnectionPool()
|
||||
|
||||
def __init__(self, conf, url):
|
||||
|
||||
# Since we are using pymongo, even though we are connecting to DB2
|
||||
# we still have to make sure that the scheme which used to distinguish
|
||||
# db2 driver from mongodb driver be replaced so that pymongo will not
|
||||
# produce an exception on the scheme.
|
||||
url = url.replace('db2:', 'mongodb:', 1)
|
||||
self.conn = self.CONNECTION_POOL.connect(
|
||||
url,
|
||||
conf.database.max_retries,
|
||||
conf.database.retry_interval)
|
||||
|
||||
# Require MongoDB 2.2 to use aggregate(), since we are using mongodb
|
||||
# as backend for test, the following code is necessary to make sure
|
||||
# that the test wont try aggregate on older mongodb during the test.
|
||||
# For db2, the versionArray won't be part of the server_info, so there
|
||||
# will not be exception when real db2 gets used as backend.
|
||||
server_info = self.conn.server_info()
|
||||
if server_info.get('sysInfo'):
|
||||
self._using_mongodb = True
|
||||
else:
|
||||
self._using_mongodb = False
|
||||
|
||||
if self._using_mongodb and server_info.get('versionArray') < [2, 2]:
|
||||
raise storage.StorageBadVersion("Need at least MongoDB 2.2")
|
||||
|
||||
connection_options = pymongo.uri_parser.parse_uri(url)
|
||||
self.db = getattr(self.conn, connection_options['database'])
|
||||
if connection_options.get('username'):
|
||||
self.db.authenticate(connection_options['username'],
|
||||
connection_options['password'])
|
||||
|
||||
self.upgrade()
|
||||
|
||||
def clear(self):
|
||||
# drop_database command does nothing on db2 database since this has
|
||||
# not been implemented. However calling this method is important for
|
||||
# removal of all the empty dbs created during the test runs since
|
||||
# test run is against mongodb on Jenkins
|
||||
self.conn.drop_database(self.db.name)
|
||||
self.conn.close()
|
@ -13,7 +13,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.
|
||||
"""Common functions for MongoDB and DB2 backends
|
||||
"""Common functions for MongoDB backend
|
||||
"""
|
||||
|
||||
import weakref
|
||||
|
@ -15,7 +15,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.
|
||||
"""Common functions for MongoDB and DB2 backends
|
||||
"""Common functions for MongoDB backend
|
||||
"""
|
||||
|
||||
from oslo_log import log
|
||||
@ -44,7 +44,7 @@ AVAILABLE_STORAGE_CAPABILITIES = {
|
||||
|
||||
|
||||
class Connection(base.Connection):
|
||||
"""Base Alarm Connection class for MongoDB and DB2 drivers."""
|
||||
"""Base Alarm Connection class for MongoDB driver."""
|
||||
CAPABILITIES = utils.update_nested(base.Connection.CAPABILITIES,
|
||||
COMMON_AVAILABLE_CAPABILITIES)
|
||||
|
||||
|
@ -127,7 +127,6 @@ class TestBase(testscenarios.testcase.WithScenarios, test_base.BaseTestCase):
|
||||
'mysql': MySQLManager,
|
||||
'mysql+pymysql': MySQLManager,
|
||||
'postgresql': PgSQLManager,
|
||||
'db2': MongoDbManager,
|
||||
'sqlite': SQLiteManager,
|
||||
}
|
||||
if mocks is not None:
|
||||
@ -210,7 +209,7 @@ class MixinTestsWithBackendScenarios(object):
|
||||
('sqlite', {'db_url': 'sqlite://'}),
|
||||
]
|
||||
|
||||
for db in ('MONGODB', 'MYSQL', 'PGSQL', 'HBASE', 'DB2', 'ES'):
|
||||
for db in ('MONGODB', 'MYSQL', 'PGSQL', 'HBASE'):
|
||||
if os.environ.get('AODH_TEST_%s_URL' % db):
|
||||
scenarios.append(
|
||||
(db.lower(), {'db_url': os.environ.get(
|
||||
@ -222,10 +221,3 @@ class MixinTestsWithBackendScenarios(object):
|
||||
if 'hbase' not in scenarios_db:
|
||||
scenarios.append(
|
||||
('hbase', {'db_url': 'hbase://__test__'}))
|
||||
|
||||
# Insert default value for db2 test
|
||||
if 'mongodb' in scenarios_db and 'db2' not in scenarios_db:
|
||||
scenarios.append(
|
||||
('db2', {'db_url': os.environ.get('AODH_TEST_MONGODB_URL',
|
||||
'').replace('mongodb://',
|
||||
'db2://')}))
|
||||
|
@ -1,40 +0,0 @@
|
||||
#
|
||||
# Copyright Ericsson AB 2014. All rights reserved
|
||||
#
|
||||
# Authors: Ildiko Vancsa <ildiko.vancsa@ericsson.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.
|
||||
"""Tests for aodh/storage/impl_db2.py
|
||||
|
||||
.. note::
|
||||
In order to run the tests against another MongoDB server set the
|
||||
environment variable aodh_TEST_DB2_URL to point to a DB2
|
||||
server before running the tests.
|
||||
|
||||
"""
|
||||
|
||||
from aodh.storage import impl_db2
|
||||
from aodh.tests import base as test_base
|
||||
|
||||
|
||||
class CapabilitiesTest(test_base.BaseTestCase):
|
||||
def test_alarm_capabilities(self):
|
||||
expected_capabilities = {
|
||||
'alarms': {'query': {'simple': True,
|
||||
'complex': True},
|
||||
'history': {'query': {'simple': True,
|
||||
'complex': True}}},
|
||||
}
|
||||
|
||||
actual_capabilities = impl_db2.Connection.get_capabilities()
|
||||
self.assertEqual(expected_capabilities, actual_capabilities)
|
@ -253,7 +253,7 @@ class AlarmTest(AlarmTestBase,
|
||||
self.assertNotEqual(victim.name, s.name)
|
||||
|
||||
|
||||
@tests_db.run_with('sqlite', 'mysql', 'pgsql', 'hbase', 'db2')
|
||||
@tests_db.run_with('sqlite', 'mysql', 'pgsql', 'hbase')
|
||||
class AlarmHistoryTest(AlarmTestBase,
|
||||
tests_db.MixinTestsWithBackendScenarios):
|
||||
|
||||
|
@ -29,9 +29,8 @@ services. You may use one of the listed database backends below to store
|
||||
Aodh data.
|
||||
|
||||
.. note::
|
||||
Please notice, MongoDB (and some other backends like DB2 and HBase)
|
||||
require pymongo_ to be installed on the system. The required minimum
|
||||
version of pymongo is 2.4.
|
||||
Please notice, MongoDB requires pymongo_ to be installed on the system. The
|
||||
required minimum version of pymongo is 2.4.
|
||||
..
|
||||
|
||||
|
||||
@ -105,17 +104,6 @@ HBase
|
||||
[database]
|
||||
connection = hbase://hbase-thrift-host:9090
|
||||
|
||||
DB2
|
||||
---
|
||||
|
||||
DB2 installation should follow fresh IBM DB2 NoSQL installation docs.
|
||||
|
||||
To use DB2 as the storage backend, change the 'database' section in
|
||||
aodh.conf as follows::
|
||||
|
||||
[database]
|
||||
connection = db2://username:password@host:27017/aodh
|
||||
|
||||
|
||||
.. _HappyBase: http://happybase.readthedocs.org/en/latest/index.html#
|
||||
.. _MongoDB: http://www.mongodb.org/
|
||||
|
@ -34,7 +34,6 @@ aodh.storage =
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user