storage: remove per-driver options

Fixes: bug #1195538

Change-Id: Iac6ace9a2402237543ed35be7f4fcee91ff3e036
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2013-07-17 16:47:27 +02:00
parent 46e673f9fb
commit 5345f4f801
9 changed files with 1 additions and 75 deletions

View File

@ -31,8 +31,6 @@ from ceilometer import storage
# how to serialize more complex objects.
flask.helpers.json = jsonutils
storage.register_opts(cfg.CONF)
def make_app(conf, enable_acl=True, attach_storage=True,
sources_file='sources.json'):

View File

@ -58,12 +58,6 @@ cfg.CONF.import_opt('connection',
group='database')
def register_opts(conf):
"""Register any options for the storage system."""
p = get_engine(conf)
p.register_opts(conf)
def get_engine(conf):
"""Load the configured engine and return an instance."""
if conf.database_connection:
@ -80,10 +74,7 @@ def get_engine(conf):
def get_connection(conf):
"""Return an open connection to the database."""
engine = get_engine(conf)
engine.register_opts(conf)
db = engine.get_connection(conf)
return db
return get_engine(conf).get_connection(conf)
class SampleFilter(object):

View File

@ -50,10 +50,6 @@ class StorageEngine(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def register_opts(self, conf):
"""Register any configuration options used by this engine."""
@abc.abstractmethod
def get_connection(self, conf):
"""Return a Connection instance based on the configuration settings."""

View File

@ -63,11 +63,6 @@ class HBaseStorage(base.StorageEngine):
}
"""
def register_opts(self, conf):
"""Register any configuration options used by this engine.
"""
pass
@staticmethod
def get_connection(conf):
"""Return a Connection instance based on the configuration settings.

View File

@ -28,10 +28,6 @@ class LogStorage(base.StorageEngine):
"""Log the data
"""
def register_opts(self, conf):
"""Register any configuration options used by this engine.
"""
def get_connection(self, conf):
"""Return a Connection instance based on the configuration settings.
"""

View File

@ -73,10 +73,6 @@ class MongoDBStorage(base.StorageEngine):
}
"""
def register_opts(self, conf):
"""Register any configuration options used by this engine.
"""
def get_connection(self, conf):
"""Return a Connection instance based on the configuration settings.
"""

View File

@ -92,12 +92,6 @@ class SQLAlchemyStorage(base.StorageEngine):
}
"""
OPTIONS = []
def register_opts(self, conf):
"""Register any configuration options used by this engine."""
conf.register_opts(self.OPTIONS)
@staticmethod
def get_connection(conf):
"""Return a Connection instance based on the configuration settings.

View File

@ -1,39 +0,0 @@
# -*- encoding: utf-8 -*-
#
# 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.
"""Tests for ceilometer/storage/
"""
from oslo.config import cfg
from ceilometer import storage
from ceilometer.storage import base
from ceilometer.tests import base as test_base
class RegisterOpts(test_base.TestCase):
def faux_get_engine(self, conf):
return self._faux_engine
def test_register_opts(self):
self.stubs.Set(storage, 'get_engine', self.faux_get_engine)
self._faux_engine = self.mox.CreateMock(base.StorageEngine)
self._faux_engine.register_opts(cfg.CONF)
self.mox.ReplayAll()
storage.register_opts(cfg.CONF)
self.mox.VerifyAll()

View File

@ -117,7 +117,6 @@ def main(argv):
#ceilometer collector by default.
default_config_files=['/etc/ceilometer/ceilometer.conf'],
)
storage.register_opts(cfg.CONF)
db = storage.get_connection(cfg.CONF)
command = extra_args[0] if extra_args else 'help'
COMMANDS[command](db, extra_args[1:])