Commit 0fcd0cad authored by René Nussbaumer's avatar René Nussbaumer

Refactor IAllocator code

The IAllocator class was handling all the requests on its own, passing
in parameters on top level which works, but is hard to maintain and not
flexible.

With the upcoming change to the IAllocator for MultiAllocate we can't
use the toplevel parameters anymore. Therefore, we refactor the code
into separate classes, which just do their own stuff. It works similiar
to Opcode containers.
Signed-off-by: default avatarRené Nussbaumer <rn@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 32683096
......@@ -283,6 +283,7 @@ confd_PYTHON = \
masterd_PYTHON = \
lib/masterd/__init__.py \
lib/masterd/iallocator.py \
lib/masterd/instance.py
impexpd_PYTHON = \
......
This diff is collapsed.
This diff is collapsed.
......@@ -42,6 +42,7 @@ from ganeti import ht
from ganeti import objects
from ganeti import compat
from ganeti import rpc
from ganeti.masterd import iallocator
from ganeti.hypervisor import hv_xen
import testutils
......@@ -409,7 +410,7 @@ class TestLoadNodeEvacResult(unittest.TestCase):
]
alloc_result = (moved, [], jobs)
assert cmdlib.IAllocator._NEVAC_RESULT(alloc_result)
assert iallocator._NEVAC_RESULT(alloc_result)
lu = _FakeLU()
result = cmdlib._LoadNodeEvacResult(lu, alloc_result,
......@@ -438,7 +439,7 @@ class TestLoadNodeEvacResult(unittest.TestCase):
alloc_result = ([], [
("inst5191.example.com", "errormsg21178"),
], [])
assert cmdlib.IAllocator._NEVAC_RESULT(alloc_result)
assert iallocator._NEVAC_RESULT(alloc_result)
lu = _FakeLU()
self.assertRaises(errors.OpExecError, cmdlib._LoadNodeEvacResult,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment