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:
@@ -25,15 +25,15 @@ class Solution(object):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._origin = None
|
self._origin = None
|
||||||
self._model = None
|
self._model = None
|
||||||
self._efficiency = 0
|
self._efficacy = 0
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def efficiency(self):
|
def efficacy(self):
|
||||||
return self._efficiency
|
return self._efficacy
|
||||||
|
|
||||||
@efficiency.setter
|
@efficacy.setter
|
||||||
def efficiency(self, e):
|
def efficacy(self, e):
|
||||||
self._efficiency = e
|
self._efficacy = e
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def model(self):
|
def model(self):
|
||||||
|
|||||||
@@ -80,8 +80,8 @@ class BasicConsolidation(BaseStrategy):
|
|||||||
# set default value for number of allowed migration attempts
|
# set default value for number of allowed migration attempts
|
||||||
self.migration_attempts = 0
|
self.migration_attempts = 0
|
||||||
|
|
||||||
# set default value for the efficiency
|
# set default value for the efficacy
|
||||||
self.efficiency = 100
|
self.efficacy = 100
|
||||||
|
|
||||||
self._ceilometer = None
|
self._ceilometer = None
|
||||||
|
|
||||||
@@ -90,8 +90,8 @@ class BasicConsolidation(BaseStrategy):
|
|||||||
self.threshold_disk = 1
|
self.threshold_disk = 1
|
||||||
self.threshold_cores = 1
|
self.threshold_cores = 1
|
||||||
|
|
||||||
# TODO(jed) target efficiency
|
# TODO(jed) target efficacy
|
||||||
self.target_efficiency = 60
|
self.target_efficacy = 60
|
||||||
|
|
||||||
# TODO(jed) weight
|
# TODO(jed) weight
|
||||||
self.weight_cpu = 1
|
self.weight_cpu = 1
|
||||||
@@ -280,10 +280,10 @@ class BasicConsolidation(BaseStrategy):
|
|||||||
0,
|
0,
|
||||||
0)
|
0)
|
||||||
|
|
||||||
def calculate_migration_efficiency(self):
|
def calculate_migration_efficacy(self):
|
||||||
"""Calculate migration efficiency
|
"""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
|
in releasing on node
|
||||||
"""
|
"""
|
||||||
if self.number_of_migrations > 0:
|
if self.number_of_migrations > 0:
|
||||||
@@ -348,7 +348,7 @@ class BasicConsolidation(BaseStrategy):
|
|||||||
# todo(jed) clone model
|
# todo(jed) clone model
|
||||||
current_model = orign_model
|
current_model = orign_model
|
||||||
|
|
||||||
self.efficiency = 100
|
self.efficacy = 100
|
||||||
unsuccessful_migration = 0
|
unsuccessful_migration = 0
|
||||||
|
|
||||||
first = True
|
first = True
|
||||||
@@ -375,8 +375,8 @@ class BasicConsolidation(BaseStrategy):
|
|||||||
|
|
||||||
while self.get_allowed_migration_attempts() >= unsuccessful_migration:
|
while self.get_allowed_migration_attempts() >= unsuccessful_migration:
|
||||||
if first is not True:
|
if first is not True:
|
||||||
self.efficiency = self.calculate_migration_efficiency()
|
self.efficacy = self.calculate_migration_efficacy()
|
||||||
if self.efficiency < float(self.target_efficiency):
|
if self.efficacy < float(self.target_efficacy):
|
||||||
break
|
break
|
||||||
first = False
|
first = False
|
||||||
score = []
|
score = []
|
||||||
@@ -483,9 +483,9 @@ class BasicConsolidation(BaseStrategy):
|
|||||||
infos = {
|
infos = {
|
||||||
"number_of_migrations": self.number_of_migrations,
|
"number_of_migrations": self.number_of_migrations,
|
||||||
"number_of_nodes_released": self.number_of_released_nodes,
|
"number_of_nodes_released": self.number_of_released_nodes,
|
||||||
"efficiency": self.efficiency
|
"efficacy": self.efficacy
|
||||||
}
|
}
|
||||||
LOG.debug(infos)
|
LOG.debug(infos)
|
||||||
self.solution.model = current_model
|
self.solution.model = current_model
|
||||||
self.solution.efficiency = self.efficiency
|
self.solution.efficacy = self.efficacy
|
||||||
return self.solution
|
return self.solution
|
||||||
|
|||||||
@@ -121,9 +121,9 @@ class TestBasicConsolidation(base.BaseTestCase):
|
|||||||
mem),
|
mem),
|
||||||
vm_0_weight_assert)
|
vm_0_weight_assert)
|
||||||
|
|
||||||
def test_calculate_migration_efficiency(self):
|
def test_calculate_migration_efficacy(self):
|
||||||
sercon = BasicConsolidation()
|
sercon = BasicConsolidation()
|
||||||
sercon.calculate_migration_efficiency()
|
sercon.calculate_migration_efficacy()
|
||||||
|
|
||||||
def test_exception_model(self):
|
def test_exception_model(self):
|
||||||
sercon = BasicConsolidation()
|
sercon = BasicConsolidation()
|
||||||
@@ -248,4 +248,4 @@ class TestBasicConsolidation(base.BaseTestCase):
|
|||||||
as mock_score_call:
|
as mock_score_call:
|
||||||
mock_score_call.return_value = 0
|
mock_score_call.return_value = 0
|
||||||
solution = sercon.execute(model)
|
solution = sercon.execute(model)
|
||||||
self.assertEqual(solution.efficiency, 100)
|
self.assertEqual(solution.efficacy, 100)
|
||||||
|
|||||||
Reference in New Issue
Block a user