Add a dynamic loading of Actions handlers in the Watcher Applier
In watcher, an audit generates a set of actions which aims at achieving a given goal (lower energy consumption, ...). It is possible to configure different strategies in order to achieve each goal. Each strategy is written as a Python class which produces a set of actions. Today, the set of possible actions is fixed for a given version of Watcher and enables optimization algorithms to include actions such as instance migration, changing hypervisor state, changing power state (ACPI level, ...). The objective of this patchset is to give the ability to load the actions dynamically in order to apply the Action Plan. DocImpact Partially implements: blueprint watcher-add-actions-via-conf Change-Id: Idf295b94dca549ac65d4636e8889c8ab2ecc0df6
This commit is contained in:
@@ -129,7 +129,7 @@ class TestModel(base.BaseTestCase):
|
||||
def test_vm_from_id_raise(self):
|
||||
fake_cluster = FakerModelCollector()
|
||||
model = fake_cluster.generate_scenario_1()
|
||||
self.assertRaises(exception.VMNotFound,
|
||||
self.assertRaises(exception.InstanceNotFound,
|
||||
model.get_vm_from_id, "valeur_qcq")
|
||||
|
||||
def test_assert_vm_raise(self):
|
||||
|
||||
@@ -20,7 +20,9 @@ from watcher.tests import base
|
||||
|
||||
|
||||
class TestDefaultPlannerLoader(base.TestCase):
|
||||
loader = default.DefaultPlannerLoader()
|
||||
def setUp(self):
|
||||
super(TestDefaultPlannerLoader, self).setUp()
|
||||
self.loader = default.DefaultPlannerLoader()
|
||||
|
||||
def test_endpoints(self):
|
||||
for endpoint in self.loader.list_available():
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from watcher.decision_engine.planner.default import DefaultPlanner
|
||||
from watcher.decision_engine.planner.manager import PlannerManager
|
||||
from watcher.decision_engine.planner import default
|
||||
from watcher.decision_engine.planner import manager as planner
|
||||
from watcher.tests import base
|
||||
|
||||
|
||||
class TestPlannerManager(base.TestCase):
|
||||
def test_load(self):
|
||||
cfg.CONF.set_override('planner', "default", group='watcher_planner')
|
||||
manager = PlannerManager()
|
||||
self.assertIsInstance(manager.load(), DefaultPlanner)
|
||||
manager = planner.PlannerManager()
|
||||
self.assertIsInstance(manager.load(), default.DefaultPlanner)
|
||||
|
||||
Reference in New Issue
Block a user