Implemented planner config module

Implemented planner config module

Partially Implements: blueprint centralise-config-opts

Change-Id: I4d710c8552ef211c6a9c38dd8f5515f68a6d36c4
This commit is contained in:
Prudhvi Rao Shedimbi
2016-11-29 21:21:16 +00:00
committed by David TARDIVEL
parent 74112dd7cf
commit 80e77a5b81
4 changed files with 47 additions and 18 deletions

View File

@@ -23,6 +23,7 @@ from watcher.conf import api
from watcher.conf import db from watcher.conf import db
from watcher.conf import exception from watcher.conf import exception
from watcher.conf import paths from watcher.conf import paths
from watcher.conf import planner
from watcher.conf import service from watcher.conf import service
from watcher.conf import utils from watcher.conf import utils
@@ -34,3 +35,4 @@ utils.register_opts(CONF)
paths.register_opts(CONF) paths.register_opts(CONF)
exception.register_opts(CONF) exception.register_opts(CONF)
db.register_opts(CONF) db.register_opts(CONF)
planner.register_opts(CONF)

View File

@@ -24,10 +24,10 @@ from watcher.conf import api as conf_api
from watcher.conf import db from watcher.conf import db
from watcher.conf import exception from watcher.conf import exception
from watcher.conf import paths from watcher.conf import paths
from watcher.conf import planner as conf_planner
from watcher.conf import utils from watcher.conf import utils
from watcher.decision_engine.audit import continuous from watcher.decision_engine.audit import continuous
from watcher.decision_engine import manager as decision_engine_manager from watcher.decision_engine import manager as decision_engine_manager
from watcher.decision_engine.planner import manager as planner_manager
def list_opts(): def list_opts():
@@ -44,7 +44,7 @@ def list_opts():
(decision_engine_manager.WATCHER_DECISION_ENGINE_OPTS + (decision_engine_manager.WATCHER_DECISION_ENGINE_OPTS +
continuous.WATCHER_CONTINUOUS_OPTS)), continuous.WATCHER_CONTINUOUS_OPTS)),
('watcher_applier', applier_manager.APPLIER_MANAGER_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), ('nova_client', clients.NOVA_CLIENT_OPTS),
('glance_client', clients.GLANCE_CLIENT_OPTS), ('glance_client', clients.GLANCE_CLIENT_OPTS),
('cinder_client', clients.CINDER_CLIENT_OPTS), ('cinder_client', clients.CINDER_CLIENT_OPTS),

41
watcher/conf/planner.py Normal file
View File

@@ -0,0 +1,41 @@
# -*- encoding: utf-8 -*-
# Copyright (c) 2016 Intel Corp
#
# Authors: Prudhvi Rao Shedimbi <prudhvi.rao.shedimbi@intel.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.
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)]

View File

@@ -15,28 +15,14 @@
# limitations under the License. # limitations under the License.
# #
from oslo_config import cfg
from oslo_log import log from oslo_log import log
from watcher.decision_engine.loading import default as loader from watcher.decision_engine.loading import default as loader
from watcher import conf
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
CONF = cfg.CONF CONF = conf.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)
class PlannerManager(object): class PlannerManager(object):