# -*- encoding: utf-8 -*- # Copyright (c) 2015 b<>com # # Authors: Jean-Emile DARTOIS # # 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. # """ The :ref:`Watcher Planner ` is part of the :ref:`Watcher Decision Engine `. This module takes the set of :ref:`Actions ` generated by a :ref:`Strategy ` and builds the design of a workflow which defines how-to schedule in time those different :ref:`Actions ` and for each :ref:`Action ` what are the prerequisite conditions. It is important to schedule :ref:`Actions ` in time in order to prevent overload of the :ref:`Cluster ` while applying the :ref:`Action Plan `. For example, it is important not to migrate too many instances at the same time in order to avoid a network congestion which may decrease the :ref:`SLA ` for :ref:`Customers `. It is also important to schedule :ref:`Actions ` in order to avoid security issues such as denial of service on core OpenStack services. :ref:`Some default implementations are provided `, but it is possible to :ref:`develop new implementations ` which are dynamically loaded by Watcher at launch time. See :doc:`../architecture` for more details on this component. """ import abc from watcher.common.loader import loadable class BasePlanner(loadable.Loadable, metaclass=abc.ABCMeta): @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 :param solution: A solution provided by a strategy for scheduling :type solution: :py:class:`~.BaseSolution` subclass instance :param audit_uuid: the audit uuid :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.ActionPlan` instance """ # example: directed acyclic graph raise NotImplementedError()