Rename efficiency to efficacy

Some Python class and packages need to be renamed
for a better compliance with the shared Terminology
which provides a better understanding of Watcher
objects and components by every contributor.

This patchset is there to change efficiency to efficacy

Partially implements: blueprint glossary-related-refactoring

Change-Id: I4c84192d49a147e0fd406da35e2805143b902331
This commit is contained in:
Jean-Emile DARTOIS
2015-12-04 19:11:34 +01:00
parent 7710b1670e
commit 454f70a19f
3 changed files with 21 additions and 21 deletions

View File

@@ -25,15 +25,15 @@ class Solution(object):
def __init__(self):
self._origin = None
self._model = None
self._efficiency = 0
self._efficacy = 0
@property
def efficiency(self):
return self._efficiency
def efficacy(self):
return self._efficacy
@efficiency.setter
def efficiency(self, e):
self._efficiency = e
@efficacy.setter
def efficacy(self, e):
self._efficacy = e
@property
def model(self):

View File

@@ -80,8 +80,8 @@ class BasicConsolidation(BaseStrategy):
# set default value for number of allowed migration attempts
self.migration_attempts = 0
# set default value for the efficiency
self.efficiency = 100
# set default value for the efficacy
self.efficacy = 100
self._ceilometer = None
@@ -90,8 +90,8 @@ class BasicConsolidation(BaseStrategy):
self.threshold_disk = 1
self.threshold_cores = 1
# TODO(jed) target efficiency
self.target_efficiency = 60
# TODO(jed) target efficacy
self.target_efficacy = 60
# TODO(jed) weight
self.weight_cpu = 1
@@ -280,10 +280,10 @@ class BasicConsolidation(BaseStrategy):
0,
0)
def calculate_migration_efficiency(self):
"""Calculate migration efficiency
def calculate_migration_efficacy(self):
"""Calculate migration efficacy
:return: The efficiency tells us that every VM migration resulted
:return: The efficacy tells us that every VM migration resulted
in releasing on node
"""
if self.number_of_migrations > 0:
@@ -348,7 +348,7 @@ class BasicConsolidation(BaseStrategy):
# todo(jed) clone model
current_model = orign_model
self.efficiency = 100
self.efficacy = 100
unsuccessful_migration = 0
first = True
@@ -375,8 +375,8 @@ class BasicConsolidation(BaseStrategy):
while self.get_allowed_migration_attempts() >= unsuccessful_migration:
if first is not True:
self.efficiency = self.calculate_migration_efficiency()
if self.efficiency < float(self.target_efficiency):
self.efficacy = self.calculate_migration_efficacy()
if self.efficacy < float(self.target_efficacy):
break
first = False
score = []
@@ -483,9 +483,9 @@ class BasicConsolidation(BaseStrategy):
infos = {
"number_of_migrations": self.number_of_migrations,
"number_of_nodes_released": self.number_of_released_nodes,
"efficiency": self.efficiency
"efficacy": self.efficacy
}
LOG.debug(infos)
self.solution.model = current_model
self.solution.efficiency = self.efficiency
self.solution.efficacy = self.efficacy
return self.solution

View File

@@ -121,9 +121,9 @@ class TestBasicConsolidation(base.BaseTestCase):
mem),
vm_0_weight_assert)
def test_calculate_migration_efficiency(self):
def test_calculate_migration_efficacy(self):
sercon = BasicConsolidation()
sercon.calculate_migration_efficiency()
sercon.calculate_migration_efficacy()
def test_exception_model(self):
sercon = BasicConsolidation()
@@ -248,4 +248,4 @@ class TestBasicConsolidation(base.BaseTestCase):
as mock_score_call:
mock_score_call.return_value = 0
solution = sercon.execute(model)
self.assertEqual(solution.efficiency, 100)
self.assertEqual(solution.efficacy, 100)