diff --git a/htools/Ganeti/HTools/Cluster.hs b/htools/Ganeti/HTools/Cluster.hs index 821cd474fe9b908361c4c7c8797b1cc738feacc6..deb56ddc1627e857a56baafd643167b51bbe01ce 100644 --- a/htools/Ganeti/HTools/Cluster.hs +++ b/htools/Ganeti/HTools/Cluster.hs @@ -488,7 +488,7 @@ allocateOnSingle nl inst new_pdx = Instance.instMatchesPolicy inst (Node.iPolicy p) new_p <- Node.addPri p inst let new_nl = Container.add new_pdx new_p nl - new_score = compCV nl + new_score = compCV new_nl return (new_nl, new_inst, [new_p], new_score) -- | Tries to allocate an instance on a given pair of nodes. diff --git a/lib/client/gnt_debug.py b/lib/client/gnt_debug.py index f22d64ae641e12ce9f6e73c2f9cb44a3a570b163..f7acc740584a6d5951e6eb30d0e7cf93e70af89a 100644 --- a/lib/client/gnt_debug.py +++ b/lib/client/gnt_debug.py @@ -174,7 +174,8 @@ def TestAllocator(opts, args): direction=opts.direction, allocator=opts.iallocator, evac_mode=opts.evac_mode, - target_groups=target_groups) + target_groups=target_groups, + spindle_use=opts.spindle_use) result = SubmitOpCode(op, opts=opts) ToStdout("%s" % result) return 0 @@ -673,6 +674,8 @@ commands = { utils.CommaJoin(constants.IALLOCATOR_NEVAC_MODES))), cli_option("--target-groups", help="Target groups for relocation", default=[], action="append"), + cli_option("--spindle-use", help="How many spindles to use", + default=1, type="int"), DRY_RUN_OPT, PRIORITY_OPT, ], "{opts...} <instance>", "Executes a TestAllocator OpCode"), diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 1c72e9e24801aca32c5de4aff082e3a88d920c6d..5af310d8d647f4d81ae142a33b552ba10f79a56c 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -15437,6 +15437,7 @@ class LUTestAllocator(NoHooksLU): nics=self.op.nics, vcpus=self.op.vcpus, hypervisor=self.op.hypervisor, + spindle_use=self.op.spindle_use, ) elif self.op.mode == constants.IALLOCATOR_MODE_RELOC: ial = IAllocator(self.cfg, self.rpc, diff --git a/lib/opcodes.py b/lib/opcodes.py index 2995bc2adc47601cfe7a287d4b432aceac99a5c6..3ca448bd0468e45763f3688bc74ee94c03e0cd9f 100644 --- a/lib/opcodes.py +++ b/lib/opcodes.py @@ -1861,6 +1861,7 @@ class OpTestAllocator(OpCode): ("evac_mode", None, ht.TOr(ht.TNone, ht.TElemOf(constants.IALLOCATOR_NEVAC_MODES)), None), ("target_groups", None, ht.TMaybeListOf(ht.TNonEmptyString), None), + ("spindle_use", 1, ht.TPositiveInt, None), ]