Skip to content
Snippets Groups Projects
Commit 09123222 authored by René Nussbaumer's avatar René Nussbaumer
Browse files

Fix gnt-debug iallocator


There was an issue with the recent ipolicy introduction which lead to a
bug in gnt-debug iallocator. It was not providing the spindle_use field
and therefore it wont let you create a valid iallocator request.

Signed-off-by: default avatarRené Nussbaumer <rn@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 8ad0da1e
No related branches found
No related tags found
No related merge requests found
...@@ -174,7 +174,8 @@ def TestAllocator(opts, args): ...@@ -174,7 +174,8 @@ def TestAllocator(opts, args):
direction=opts.direction, direction=opts.direction,
allocator=opts.iallocator, allocator=opts.iallocator,
evac_mode=opts.evac_mode, evac_mode=opts.evac_mode,
target_groups=target_groups) target_groups=target_groups,
spindle_use=opts.spindle_use)
result = SubmitOpCode(op, opts=opts) result = SubmitOpCode(op, opts=opts)
ToStdout("%s" % result) ToStdout("%s" % result)
return 0 return 0
...@@ -672,6 +673,8 @@ commands = { ...@@ -672,6 +673,8 @@ commands = {
utils.CommaJoin(constants.IALLOCATOR_NEVAC_MODES))), utils.CommaJoin(constants.IALLOCATOR_NEVAC_MODES))),
cli_option("--target-groups", help="Target groups for relocation", cli_option("--target-groups", help="Target groups for relocation",
default=[], action="append"), default=[], action="append"),
cli_option("--spindle-use", help="How many spindles to use",
default=1, type="int"),
DRY_RUN_OPT, PRIORITY_OPT, DRY_RUN_OPT, PRIORITY_OPT,
], ],
"{opts...} <instance>", "Executes a TestAllocator OpCode"), "{opts...} <instance>", "Executes a TestAllocator OpCode"),
......
...@@ -15295,6 +15295,7 @@ class LUTestAllocator(NoHooksLU): ...@@ -15295,6 +15295,7 @@ class LUTestAllocator(NoHooksLU):
nics=self.op.nics, nics=self.op.nics,
vcpus=self.op.vcpus, vcpus=self.op.vcpus,
hypervisor=self.op.hypervisor, hypervisor=self.op.hypervisor,
spindle_use=self.op.spindle_use,
) )
elif self.op.mode == constants.IALLOCATOR_MODE_RELOC: elif self.op.mode == constants.IALLOCATOR_MODE_RELOC:
ial = IAllocator(self.cfg, self.rpc, ial = IAllocator(self.cfg, self.rpc,
......
...@@ -1853,6 +1853,7 @@ class OpTestAllocator(OpCode): ...@@ -1853,6 +1853,7 @@ class OpTestAllocator(OpCode):
("evac_mode", None, ("evac_mode", None,
ht.TOr(ht.TNone, ht.TElemOf(constants.IALLOCATOR_NEVAC_MODES)), None), ht.TOr(ht.TNone, ht.TElemOf(constants.IALLOCATOR_NEVAC_MODES)), None),
("target_groups", None, ht.TMaybeListOf(ht.TNonEmptyString), None), ("target_groups", None, ht.TMaybeListOf(ht.TNonEmptyString), None),
("spindle_use", 1, ht.TPositiveInt, None),
] ]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment