Remove unnecessary db configuration.

oslo.db has everything necessary for configuring db adapters,
connections, drivers, etc.
Removing useless base db class and respective configuration parameters.

Change-Id: I47af59681cb60622ec990b1efd2d05af1d67a29e
Depends-On: Change-Id: I7cdd01b3f1fe182ac76cacf060beb8e0a0017aa7
This commit is contained in:
Dimitri Mazmanov 2016-03-17 15:45:23 +01:00
parent 0a22b45205
commit 4b34887dcc
4 changed files with 3 additions and 53 deletions

View File

@ -4,7 +4,6 @@ wrap_width = 79
namespace = kingbird.common.config
namespace = kingbird.common.manager
namespace = kingbird.common.baserpc
namespace = kingbird.db.base
namespace = kingbird.engine.engine_config
namespace = kingbird.engine.kingbird_lock
namespace = kingbird.engine.quota_manager

View File

@ -42,8 +42,6 @@ from oslo_config import cfg
from oslo_log import log as logging
from oslo_service import periodic_task
from kingbird.db import base
CONF = cfg.CONF
LOG = logging.getLogger(__name__)
@ -64,16 +62,16 @@ class PeriodicTasks(periodic_task.PeriodicTasks):
super(PeriodicTasks, self).__init__(CONF)
class Manager(base.Base, PeriodicTasks):
class Manager(PeriodicTasks):
def __init__(self, host=None, db_driver=None, service_name='undefined'):
def __init__(self, host=None, service_name='undefined'):
if not host:
host = cfg.CONF.host_details.host
self.host = host
self.service_name = service_name
# self.notifier = rpc.get_notifier(self.service_name, self.host)
self.additional_endpoints = []
super(Manager, self).__init__(db_driver)
super(Manager, self).__init__()
def periodic_tasks(self, context, raise_on_error=False):
"""Tasks to be run at a periodic interval."""

View File

@ -1,46 +0,0 @@
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# 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.
# copy and modify from nova.db
"""Base class for classes that need modular database access."""
from oslo_config import cfg
from oslo_utils import importutils
db_driver_opt = [
cfg.StrOpt('db_driver',
default='kingbird.db',
help='The driver to use for database access')
]
CONF = cfg.CONF
db_option_group = cfg.OptGroup('db_options')
cfg.CONF.register_group(db_option_group)
cfg.CONF.register_opts(db_driver_opt, group=db_option_group)
class Base(object):
"""DB driver is injected in the init method."""
def __init__(self, db_driver=None):
super(Base, self).__init__()
if not db_driver:
db_driver = CONF.db_options.db_driver
self.db = importutils.import_module(db_driver)
def list_opts():
yield db_option_group.name, db_driver_opt

View File

@ -36,7 +36,6 @@ oslo.config.opts =
kingbird.engine.listener = kingbird.engine.listener:list_opts
kingbird.engine.quota_manager = kingbird.engine.quota_manager:list_opts
kingbird.common.api.api_config = kingbird.api.api_config:list_opts
kingbird.db.base= kingbird.db.base:list_opts
kingbird.common.baserpc= kingbird.common.baserpc:list_opts
kingbird.api.controllers.quota_manage= kingbird.api.controllers.quota_manage:list_opts