Last use removed in 9271c98e6fd918.
Signed-off-by: Brian Foley <[email protected]>
---
lib/utils/__init__.py | 28 ----------------------------
test/py/ganeti.utils_unittest.py | 16 +---------------
2 files changed, 1 insertion(+), 43 deletions(-)
diff --git a/lib/utils/__init__.py b/lib/utils/__init__.py
index ce89869..aa1a27d 100644
--- a/lib/utils/__init__.py
+++ b/lib/utils/__init__.py
@@ -365,34 +365,6 @@ def GetHomeDir(user, default=None):
return result.pw_dir
-def FirstFree(seq, base=0):
- """Returns the first non-existing integer from seq.
-
- The seq argument should be a sorted list of positive integers. The
- first time the index of an element is smaller than the element
- value, the index will be returned.
-
- The base argument is used to start at a different offset,
- i.e. C{[3, 4, 6]} with I{offset=3} will return 5.
-
- Example: C{[0, 1, 3]} will return I{2}.
-
- @type seq: sequence
- @param seq: the sequence to be analyzed.
- @type base: int
- @param base: use this value as the base index of the sequence
- @rtype: int
- @return: the first non-used index in the sequence
-
- """
- for idx, elem in enumerate(seq):
- assert elem >= base, "Passed element is higher than base offset"
- if elem > idx + base:
- # idx is not used
- return idx + base
- return None
-
-
def SingleWaitForFdCondition(fdobj, event, timeout):
"""Waits for a condition to occur on the socket.
diff --git a/test/py/ganeti.utils_unittest.py b/test/py/ganeti.utils_unittest.py
index 5ebe78a..00d01e6 100755
--- a/test/py/ganeti.utils_unittest.py
+++ b/test/py/ganeti.utils_unittest.py
@@ -54,9 +54,7 @@ from ganeti import compat
from ganeti import utils
from ganeti import errors
from ganeti import constants
-from ganeti.utils import RunCmd, \
- FirstFree, \
- RunParts
+from ganeti.utils import RunCmd, RunParts
class TestParseCpuMask(unittest.TestCase):
@@ -109,18 +107,6 @@ class TestGetMounts(unittest.TestCase):
])
-class TestFirstFree(unittest.TestCase):
- """Test case for the FirstFree function"""
-
- def test(self):
- """Test FirstFree"""
- self.failUnlessEqual(FirstFree([0, 1, 3]), 2)
- self.failUnlessEqual(FirstFree([]), None)
- self.failUnlessEqual(FirstFree([3, 4, 6]), 0)
- self.failUnlessEqual(FirstFree([3, 4, 6], base=3), 5)
- self.failUnlessRaises(AssertionError, FirstFree, [0, 3, 4, 6], base=3)
-
-
class TestTimeFunctions(unittest.TestCase):
"""Test case for time functions"""
--
2.8.0.rc3.226.g39d4020