Enabled config parameters to plugins

In this changeset, I added the possibility for all plugins to define
configuration parameters for themselves.

Partially Implements: blueprint plugins-parameters

Change-Id: I676b2583b3b4841c64c862b2b0c234b4eb5fd0fd
This commit is contained in:
Vincent Françoise
2016-05-09 09:32:27 +02:00
parent dcb5c1f9fc
commit 5aa6b16238
22 changed files with 453 additions and 129 deletions

View File

@@ -47,12 +47,24 @@ See :doc:`../architecture` for more details on this component.
import abc
import six
from watcher.common.loader import loadable
@six.add_metaclass(abc.ABCMeta)
class BasePlanner(object):
class BasePlanner(loadable.Loadable):
@classmethod
def get_config_opts(cls):
"""Defines the configuration options to be associated to this loadable
:return: A list of configuration options relative to this Loadable
:rtype: list of :class:`oslo_config.cfg.Opt` instances
"""
return []
@abc.abstractmethod
def schedule(self, context, audit_uuid, solution):
"""The planner receives a solution to schedule
"""The planner receives a solution to schedule
:param solution: A solution provided by a strategy for scheduling
:type solution: :py:class:`~.BaseSolution` subclass instance
@@ -60,7 +72,7 @@ class BasePlanner(object):
:type audit_uuid: str
:return: Action plan with an ordered sequence of actions such that all
security, dependency, and performance requirements are met.
:rtype: :py:class:`watcher.objects.action_plan.ActionPlan` instance
:rtype: :py:class:`watcher.objects.ActionPlan` instance
"""
# example: directed acyclic graph
raise NotImplementedError()

View File

@@ -17,10 +17,10 @@
from __future__ import unicode_literals
from watcher.common.loader.default import DefaultLoader
from watcher.common.loader import default
class DefaultPlannerLoader(DefaultLoader):
class DefaultPlannerLoader(default.DefaultLoader):
def __init__(self):
super(DefaultPlannerLoader, self).__init__(
namespace='watcher_planners')