diff --git a/watcher/conf/__init__.py b/watcher/conf/__init__.py index 940c982d7..aed92ceb3 100644 --- a/watcher/conf/__init__.py +++ b/watcher/conf/__init__.py @@ -23,6 +23,7 @@ from watcher.conf import api from watcher.conf import db from watcher.conf import exception from watcher.conf import paths +from watcher.conf import planner from watcher.conf import service from watcher.conf import utils @@ -34,3 +35,4 @@ utils.register_opts(CONF) paths.register_opts(CONF) exception.register_opts(CONF) db.register_opts(CONF) +planner.register_opts(CONF) diff --git a/watcher/conf/_opts.py b/watcher/conf/_opts.py index 22328d261..246558510 100644 --- a/watcher/conf/_opts.py +++ b/watcher/conf/_opts.py @@ -24,10 +24,10 @@ from watcher.conf import api as conf_api from watcher.conf import db from watcher.conf import exception from watcher.conf import paths +from watcher.conf import planner as conf_planner from watcher.conf import utils from watcher.decision_engine.audit import continuous from watcher.decision_engine import manager as decision_engine_manager -from watcher.decision_engine.planner import manager as planner_manager def list_opts(): @@ -44,7 +44,7 @@ def list_opts(): (decision_engine_manager.WATCHER_DECISION_ENGINE_OPTS + continuous.WATCHER_CONTINUOUS_OPTS)), ('watcher_applier', applier_manager.APPLIER_MANAGER_OPTS), - ('watcher_planner', planner_manager.WATCHER_PLANNER_OPTS), + ('watcher_planner', conf_planner.WATCHER_PLANNER_OPTS), ('nova_client', clients.NOVA_CLIENT_OPTS), ('glance_client', clients.GLANCE_CLIENT_OPTS), ('cinder_client', clients.CINDER_CLIENT_OPTS), diff --git a/watcher/conf/planner.py b/watcher/conf/planner.py new file mode 100644 index 000000000..c06bcccae --- /dev/null +++ b/watcher/conf/planner.py @@ -0,0 +1,41 @@ +# -*- encoding: utf-8 -*- +# Copyright (c) 2016 Intel Corp +# +# Authors: Prudhvi Rao Shedimbi +# +# 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. + +from oslo_config import cfg + +watcher_planner = cfg.OptGroup(name='watcher_planner', + title='Defines the parameters of ' + 'the planner') + +default_planner = 'default' + +WATCHER_PLANNER_OPTS = { + cfg.StrOpt('planner', + default=default_planner, + required=True, + help='The selected planner used to schedule the actions') +} + + +def register_opts(conf): + conf.register_group(watcher_planner) + conf.register_opts(WATCHER_PLANNER_OPTS, group=watcher_planner) + + +def list_opts(): + return [('watcher_planner', WATCHER_PLANNER_OPTS)] diff --git a/watcher/decision_engine/planner/manager.py b/watcher/decision_engine/planner/manager.py index 8cda270ab..716947020 100644 --- a/watcher/decision_engine/planner/manager.py +++ b/watcher/decision_engine/planner/manager.py @@ -15,28 +15,14 @@ # limitations under the License. # -from oslo_config import cfg from oslo_log import log from watcher.decision_engine.loading import default as loader +from watcher import conf LOG = log.getLogger(__name__) -CONF = cfg.CONF - -default_planner = 'default' - -WATCHER_PLANNER_OPTS = { - cfg.StrOpt('planner', - default=default_planner, - required=True, - help='The selected planner used to schedule the actions') -} -planner_opt_group = cfg.OptGroup(name='watcher_planner', - title='Defines the parameters of ' - 'the planner') -CONF.register_group(planner_opt_group) -CONF.register_opts(WATCHER_PLANNER_OPTS, planner_opt_group) +CONF = conf.CONF class PlannerManager(object):