diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index d74c97a3cfe253d6b3790eb7745940327b3ed6e9..3e86e480d1944227d21f4ccd2f1f0a0c5f001ef3 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -1016,8 +1016,8 @@ def _CheckInstanceState(lu, instance, req_states, msg=None):
(instance.name, msg), errors.ECODE_STATE)
-def _CheckMinMaxSpecs(name, ipolicy, value):
- """Checks if value is in the desired range.
+def _ComputeMinMaxSpec(name, ipolicy, value):
+ """Computes if value is in the desired range.
@param name: name of the parameter for which we perform the check
@param ipolicy: dictionary containing min, max and std values
@@ -1038,7 +1038,7 @@ def _CheckMinMaxSpecs(name, ipolicy, value):
def _ComputeIPolicySpecViolation(ipolicy, mem_size, cpu_count, disk_count,
nic_count, disk_sizes,
- _check_spec_fn=_CheckMinMaxSpecs):
+ _compute_fn=_ComputeMinMaxSpec):
"""Verifies ipolicy against provided specs.
@type ipolicy: dict
@@ -1053,7 +1053,7 @@ def _ComputeIPolicySpecViolation(ipolicy, mem_size, cpu_count, disk_count,
@param nic_count: Number of nics used
@type disk_sizes: list of ints
@param disk_sizes: Disk sizes of used disk (len must match C{disk_count})
- @param _check_spec_fn: The checking function (unittest only)
+ @param _compute_fn: The compute function (unittest only)
@return: A list of violations, or an empty list of no violations are found
"""
@@ -1067,7 +1067,7 @@ def _ComputeIPolicySpecViolation(ipolicy, mem_size, cpu_count, disk_count,
] + map((lambda d: (constants.ISPEC_DISK_SIZE, d)), disk_sizes)
return filter(None,
- (_check_spec_fn(name, ipolicy, value)
+ (_compute_fn(name, ipolicy, value)
for (name, value) in test_settings))
diff --git a/test/ganeti.cmdlib_unittest.py b/test/ganeti.cmdlib_unittest.py
index 881e6469869dcb53491c22560e3dc82c9f91ce0e..6e1d19b2cfcea0002cc81607910430954931f251 100755
--- a/test/ganeti.cmdlib_unittest.py
+++ b/test/ganeti.cmdlib_unittest.py
@@ -570,7 +570,7 @@ class TestDiskStateHelper(unittest.TestCase):
new, None)
-def _ValidateCheckMinMaxSpec(name, *_):
+def _ValidateComputeMinMaxSpec(name, *_):
assert name in constants.ISPECS_PARAMETERS
return None
@@ -579,15 +579,15 @@ class _SpecWrapper:
def __init__(self, spec):
self.spec = spec
- def CheckMinMaxSpec(self, *args):
+ def ComputeMinMaxSpec(self, *args):
return self.spec.pop(0)
class TestComputeIPolicySpecViolation(unittest.TestCase):
def test(self):
- check_fn = _ValidateCheckMinMaxSpec
+ compute_fn = _ValidateComputeMinMaxSpec
ret = cmdlib._ComputeIPolicySpecViolation(NotImplemented, 1024, 1, 1, 1,
- [1024], _check_spec_fn=check_fn)
+ [1024], _compute_fn=compute_fn)
self.assertEqual(ret, [])
def testInvalidArguments(self):
@@ -596,9 +596,9 @@ class TestComputeIPolicySpecViolation(unittest.TestCase):
def testInvalidSpec(self):
spec = _SpecWrapper([None, False, "foo", None, "bar"])
- check_fn = spec.CheckMinMaxSpec
+ compute_fn = spec.ComputeMinMaxSpec
ret = cmdlib._ComputeIPolicySpecViolation(NotImplemented, 1024, 1, 1, 1,
- [1024], _check_spec_fn=check_fn)
+ [1024], _compute_fn=compute_fn)
self.assertEqual(ret, ["foo", "bar"])
self.assertFalse(spec.spec)