This patch, extends the 'cmdlib.instance_unittest.py' with a new test for instances multi allocations, in order to test an allocation of more than one instances.
Signed-off-by: Dimitris Bliablias <[email protected]> --- test/py/cmdlib/instance_unittest.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/py/cmdlib/instance_unittest.py b/test/py/cmdlib/instance_unittest.py index 5200af4..336fccb 100644 --- a/test/py/cmdlib/instance_unittest.py +++ b/test/py/cmdlib/instance_unittest.py @@ -1692,6 +1692,21 @@ class TestLUInstanceMultiAlloc(CmdlibTestCase): iallocator="mock_ialloc") self.ExecOpCode(op) + def testManyInstancesWithIAllocator(self): + snode = self.cfg.AddNewNode() + + inst1 = self.CopyOpCode(self.inst_op) + inst2 = self.CopyOpCode(self.inst_op, instance_name="inst2.example.com") + + self.iallocator_cls.return_value.result = \ + ([("inst.example.com", [self.master.name, snode.name]), + ("inst2.example.com", [self.master.name, snode.name])], + []) + + op = opcodes.OpInstanceMultiAlloc(instances=[inst1, inst2], + iallocator="mock_ialloc") + self.ExecOpCode(op) + def testWithIAllocatorOpportunisticLocking(self): snode = self.cfg.AddNewNode() self.iallocator_cls.return_value.result = \ -- 2.1.4
