Merge "Use taskflow library for building and executing action plans"

This commit is contained in:
Jenkins
2016-01-21 17:38:13 +00:00
committed by Gerrit Code Review
44 changed files with 1234 additions and 848 deletions

View File

@@ -0,0 +1,27 @@
# -*- encoding: utf-8 -*-
# Copyright (c) 2016 b<>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 watcher.decision_engine.strategy.strategies import basic_consolidation
from watcher.decision_engine.strategy.strategies import dummy_strategy
from watcher.decision_engine.strategy.strategies import outlet_temp_control
BasicConsolidation = basic_consolidation.BasicConsolidation
OutletTempControl = outlet_temp_control.OutletTempControl
DummyStrategy = dummy_strategy.DummyStrategy
__all__ = (BasicConsolidation, OutletTempControl, DummyStrategy)

View File

@@ -336,11 +336,11 @@ class BasicConsolidation(BaseStrategy):
def add_migration(self,
applies_to,
migration_type,
src_hypervisor_uuid,
dst_hypervisor_uuid):
src_hypervisor,
dst_hypervisor):
parameters = {'migration_type': migration_type,
'src_hypervisor_uuid': src_hypervisor_uuid,
'dst_hypervisor_uuid': dst_hypervisor_uuid}
'src_hypervisor': src_hypervisor,
'dst_hypervisor': dst_hypervisor}
self.solution.add_action(action_type=self.MIGRATION,
applies_to=applies_to,
input_parameters=parameters)

View File

@@ -28,6 +28,7 @@ class DummyStrategy(BaseStrategy):
DEFAULT_DESCRIPTION = "Dummy Strategy"
NOP = "nop"
SLEEP = "sleep"
def __init__(self, name=DEFAULT_NAME, description=DEFAULT_DESCRIPTION):
super(DummyStrategy, self).__init__(name, description)
@@ -38,6 +39,12 @@ class DummyStrategy(BaseStrategy):
applies_to="",
input_parameters=parameters)
# todo(jed) add a new action to test the flow
# with two differents actions
parameters = {'message': 'Welcome'}
self.solution.add_action(action_type=self.NOP,
applies_to="",
input_parameters=parameters)
self.solution.add_action(action_type=self.SLEEP,
applies_to="",
input_parameters={'duration': '5'})
return self.solution

View File

@@ -237,8 +237,8 @@ class OutletTempControl(BaseStrategy):
mig_src_hypervisor,
mig_dst_hypervisor):
parameters = {'migration_type': 'live',
'src_hypervisor_uuid': mig_src_hypervisor,
'dst_hypervisor_uuid': mig_dst_hypervisor}
'src_hypervisor': mig_src_hypervisor,
'dst_hypervisor': mig_dst_hypervisor}
self.solution.add_action(action_type=self.MIGRATION,
applies_to=vm_src,
input_parameters=parameters)