Watcher Planner Selector

This component is responsible for selecting an appropriate Planner based
on predefined property value passed to concrete Strategy.

Change-Id: I86de95886df5d7e9558512569601e9ea3babb0e9
Implements: bp watcher-planner-selector
Co-Authored-By: Canwei Li <li.canwei2@zte.com.cn>
This commit is contained in:
Egor Panfilov
2018-04-22 22:18:13 +03:00
committed by licanwei
parent 7d1b179d32
commit aa2a084d22
7 changed files with 47 additions and 27 deletions

View File

@@ -30,7 +30,8 @@ class DefaultStrategyContext(base.StrategyContext):
super(DefaultStrategyContext, self).__init__()
LOG.debug("Initializing Strategy Context")
def do_execute_strategy(self, audit, request_context):
@staticmethod
def select_strategy(audit, request_context):
osc = clients.OpenStackClients()
# todo(jed) retrieve in audit parameters (threshold,...)
# todo(jed) create ActionPlan
@@ -50,9 +51,10 @@ class DefaultStrategyContext(base.StrategyContext):
goal_name=goal.name,
strategy_name=strategy_name,
osc=osc)
return strategy_selector.select()
selected_strategy = strategy_selector.select()
def do_execute_strategy(self, audit, request_context):
selected_strategy = self.select_strategy(audit, request_context)
selected_strategy.audit_scope = audit.scope
schema = selected_strategy.get_schema()