Multiple global efficacy

This patch update the global efficacy for server consolidation
strategy, test cases and general format.

Change-Id: I62af1e4be415998669f938b3d587c1ccf4293419
Implements: blueprint multiple-global-efficacy-indicator
This commit is contained in:
aditi
2017-09-19 08:09:11 +00:00
parent a3be1587e3
commit 71730c0eaf
8 changed files with 18 additions and 12 deletions

View File

@@ -57,7 +57,8 @@ class EfficacySpecification(object):
efficacy indicators related to this spec
:type indicators_map: :py:class:`~.IndicatorsMap` instance
:raises: NotImplementedError
:returns: :py:class:`~.Indicator` instance
:returns: :py:class:`~.Indicator` instance list, each instance specify
global efficacy for different openstack resource.
"""
raise NotImplementedError()

View File

@@ -40,14 +40,16 @@ class ServerConsolidation(base.EfficacySpecification):
def get_global_efficacy_indicator(self, indicators_map=None):
value = 0
global_efficacy = []
if indicators_map and indicators_map.compute_nodes_count > 0:
value = (float(indicators_map.released_compute_nodes_count) /
float(indicators_map.compute_nodes_count)) * 100
return efficacy.Indicator(
global_efficacy.append(efficacy.Indicator(
name="released_nodes_ratio",
description=_("Ratio of released compute nodes divided by the "
"total number of enabled compute nodes."),
unit='%',
value=value,
)
))
return global_efficacy