Add strategy template doc

Developer should provide a detailled documentation about his strategy
algorithm to make it even easier to use by a Watcher end user.
I propose in this changeset a template for strategy documentation.
you will find also a example with basic consolidation strategy.

Change-Id: I66da1a33b87a94b508dd23ac7dce4cae6f4e068b
This commit is contained in:
David TARDIVEL
2016-10-05 17:05:39 +02:00
parent ff81f237a7
commit 3de2d368c0
9 changed files with 302 additions and 34 deletions

View File

@@ -37,9 +37,9 @@ class ServerConsolidation(base.EfficacySpecification):
indicators.InstanceMigrationsCount(),
]
def get_global_efficacy_indicator(self, indicators_map):
def get_global_efficacy_indicator(self, indicators_map=None):
value = 0
if indicators_map.instance_migrations_count > 0:
if indicators_map and indicators_map.instance_migrations_count > 0:
value = (float(indicators_map.released_compute_nodes_count) /
float(indicators_map.instance_migrations_count)) * 100

View File

@@ -28,16 +28,10 @@ LOG = log.getLogger(__name__)
class NovaClusterDataModelCollector(base.BaseClusterDataModelCollector):
"""nova
"""Nova cluster data model collector
*Description*
This Nova cluster data model collector creates an in-memory representation
of the resources exposed by the compute service.
*Spec URL*
<None>
The Nova cluster data model collector creates an in-memory
representation of the resources exposed by the compute service.
"""
def __init__(self, config, osc=None):

View File

@@ -25,6 +25,14 @@ it becomes necessary to migrate VMs among servers to lower the costs. However,
migration of VMs introduces runtime overheads and consumes extra energy, thus
a good server consolidation strategy should carefully plan for migration in
order to both minimize energy consumption and comply to the various SLAs.
This algorithm not only minimizes the overall number of used servers, but also
minimizes the number of migrations.
It has been developed only for tests. You must have at least 2 physical compute
nodes to run it, so you can easilly run it on DevStack. It assumes that live
migration is possible on your OpenStack cluster.
"""
from oslo_log import log
@@ -39,28 +47,7 @@ LOG = log.getLogger(__name__)
class BasicConsolidation(base.ServerConsolidationBaseStrategy):
"""Basic offline consolidation using live migration
*Description*
This is server consolidation algorithm which not only minimizes the overall
number of used servers, but also minimizes the number of migrations.
*Requirements*
* You must have at least 2 physical compute nodes to run this strategy.
*Limitations*
- It has been developed only for tests.
- It assumes that the virtual machine and the compute node are on the same
private network.
- It assumes that live migrations are possible.
*Spec URL*
<None>
"""
"""Basic offline consolidation using live migration"""
HOST_CPU_USAGE_METRIC_NAME = 'compute.node.cpu.percent'
INSTANCE_CPU_USAGE_METRIC_NAME = 'cpu_util'